coollabsio/coolify · error · Exception

Unsupported database type: $databaseType

Error message

Unsupported database type: $databaseType

What it means

Plain \Exception thrown from StartDatabaseProxy when the match on $databaseType hits its default arm - the database's type string is not one of the supported standalone-*/service proxy types. The type comes from $database->databaseType(); for ServiceDatabase it derives from the service template image, so any template or morph class outside the known list fails here when starting the database proxy.

Source

Thrown at app/Actions/Database/StartDatabaseProxy.php:49

        $network = data_get($database, 'destination.network');
        $server = data_get($database, 'destination.server');
        $containerName = data_get($database, 'uuid');
        $proxyContainerName = "{$database->uuid}-proxy";
        $isSSLEnabled = $database->enable_ssl ?? false;

        if ($database->getMorphClass() === ServiceDatabase::class) {
            $databaseType = $database->databaseType();
            $network = $database->service->uuid;
            $server = data_get($database, 'service.destination.server');
            $containerName = "{$database->name}-{$database->service->uuid}";
        }
        $internalPort = match ($databaseType) {
            'standalone-mariadb', 'standalone-mysql' => 3306,
            'standalone-postgresql', 'standalone-supabase/postgres' => 5432,
            'standalone-redis', 'standalone-keydb', 'standalone-dragonfly' => 6379,
            'standalone-clickhouse' => 9000,
            'standalone-mongodb' => 27017,
            default => throw new \Exception("Unsupported database type: $databaseType"),
        };
        if ($isSSLEnabled) {
            $internalPort = match ($databaseType) {
                'standalone-redis', 'standalone-keydb', 'standalone-dragonfly' => 6380,
                default => $internalPort,
            };
        }

        $configuration_dir = database_proxy_dir($database->uuid);
        $host_configuration_dir = $configuration_dir;
        if (isDev()) {
            $host_configuration_dir = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/databases/'.$database->uuid.'/proxy';
        }
        $timeoutConfig = $this->buildProxyTimeoutConfig($database->public_port_timeout);
        $nginxconf = <<<EOF
    user  nginx;
    worker_processes  auto;

View on GitHub (pinned to 70b9acc424)

Solutions

  1. Check $database->databaseType() output for the failing database (tinker) and compare against the match arms.
  2. If the type is legitimate, add it with its internal port to the match in StartDatabaseProxy (and the SSL override map when relevant).
  3. If the type string is corrupted/mismatched, fix the database row or service template so databaseType() returns a supported value before retrying the proxy start.

Example fix

// before
$internalPort = match ($databaseType) {
    'standalone-mariadb', 'standalone-mysql' => 3306,
    ...
    default => throw new \Exception("Unsupported database type: $databaseType"),
};

// after (explicitly supported type)
$internalPort = match ($databaseType) {
    'standalone-mariadb', 'standalone-mysql' => 3306,
    'standalone-postgresql', 'standalone-supabase/postgres' => 5432,
    'standalone-redis', 'standalone-keydb', 'standalone-dragonfly' => 6379,
    'standalone-clickhouse' => 9000,
    'standalone-mongodb' => 27017,
    'standalone-mydb' => 1234, // newly registered type
    default => throw new \Exception("Unsupported database type: $databaseType"),
};
Defensive patterns

Strategy: type-guard

Validate before calling

$allowed = ['standalone-mariadb','standalone-mysql','standalone-postgresql','standalone-supabase/postgres','standalone-redis','standalone-keydb','standalone-dragonfly','standalone-clickhouse','standalone-mongodb'];
if (! in_array($database->databaseType(), $allowed, true)) {
    // do not start the proxy for unsupported types
    return;
}

Type guard

function proxySupportedDatabaseType(string $type): bool
{
    return in_array($type, [
        'standalone-mariadb', 'standalone-mysql',
        'standalone-postgresql', 'standalone-supabase/postgres',
        'standalone-redis', 'standalone-keydb', 'standalone-dragonfly',
        'standalone-clickhouse', 'standalone-mongodb',
    ], true);
}

Try / catch

try {
    StartDatabaseProxy::run($database, ...);
} catch (\Exception $e) {
    if (str_starts_with($e->getMessage(), 'Unsupported database type')) {
        // surface a friendly message; skip proxy start for this type
    } else {
        throw $e;
    }
}

Prevention

When it happens

Trigger: Starting a database proxy for a ServiceDatabase whose template declares an image/type not in the map (e.g. a custom or newly added database service); a standalone database model whose databaseType() returns an unexpected/null value; a new database kind added to Coolify without updating StartDatabaseProxy's port map.

Common situations: Custom service templates introducing exotic databases (e.g. a different port than 3306/5432/6379/9000/27017); upgrades where a new database type exists but this action was not extended; corrupted type field on the database row.

Related errors


AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17). Data as JSON: /api/errors/6291b7ecebf26a65. Report an issue: GitHub.