cube-js/cube · error · Error
Unsupported db type: ${dbType}
Error message
Unsupported db type: ${dbType} What it means
driverDependencies(dbType) maps a Cube database type to the driver package name; if a dedicated built-in mapping exists it is used, otherwise it checks whether a package named `${dbType}-cubejs-driver` is installed. If neither applies, it throws 'Unsupported db type: <dbType>', meaning Cube has no known driver package for the requested type. lookupDriverClass relies on this resolution to load the driver class.
Source
Thrown at packages/cubejs-server-core/src/core/DriverResolvers.ts:27
import DriverDependencies from './DriverDependencies';
/**
* Resolve driver module name by db type.
*/
export const driverDependencies = (dbType: DatabaseType) => {
if (DriverDependencies[dbType]) {
return DriverDependencies[dbType];
}
if (packageExists(`@cubejs-backend/${dbType}-driver`, true)) {
return `@cubejs-backend/${dbType}-driver`;
}
if (packageExists(`${dbType}-cubejs-driver`, true)) {
return `${dbType}-cubejs-driver`;
}
throw new Error(`Unsupported db type: ${dbType}`);
};
/**
* Resolve driver module object by db type.
*/
export const lookupDriverClass = (dbType): Constructor<BaseDriver> & {
dialectClass?: () => any;
getDefaultConcurrency?: () => number;
} => {
// eslint-disable-next-line global-require,import/no-dynamic-require
const module = require(
driverDependencies(dbType || process.env.CUBEJS_DB_TYPE)
);
if (module.default) {
return module.default;
}
return module;
};View on GitHub (pinned to 7d981676b3)
Solutions
- Check CUBEJS_DB_TYPE for typos and use a supported value (postgres, mysql, etc.)
- Install the matching driver package, e.g. yarn add @cubejs-backend/<dbtype>-driver (or a package named `${dbType}-cubejs-driver` for custom drivers)
- For a fully custom driver, pass a driverFactory returning a driver instance instead of relying on db-type resolution
- List supported types via the Cube docs for the installed Cube version
Example fix
// before (.env) CUBEJS_DB_TYPE=oracledb // after # install: yarn add @cubejs-backend/oracle-driver CUBEJS_DB_TYPE=oracle
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs';
function assertDbTypeSupported(dbType) {
const known = ['postgres','mysql','mssql','bigquery','duckdb','clickhouse','snowflake','databricks-jdbc','sqlite'];
const pkg = `${dbType}-cubejs-driver`;
if (!known.includes(dbType) && !packageExists(pkg)) {
throw new Error(`Unsupported db type: ${dbType}. Install ${pkg} or fix CUBEJS_DB_TYPE.`);
}
} Type guard
function isSupportedDbType(v) {
return typeof v === 'string' && v.length > 0 && /^[a-z0-9-]+$/.test(v);
} Try / catch
try {
const DriverClass = lookupDriverClass(process.env.CUBEJS_DB_TYPE);
} catch (e) {
if (/^Unsupported db type:/.test(e.message)) {
console.error(`Unknown CUBEJS_DB_TYPE '${process.env.CUBEJS_DB_TYPE}'. Install the matching -cubejs-driver package.`);
}
throw e;
} Prevention
- Only use db type values from the Cube docs for your installed version
- Install the matching @cubejs-backend/<type>-driver package alongside setting CUBEJS_DB_TYPE
- For custom drivers, name the package <type>-cubejs-driver or use driverFactory directly
- Add a startup smoke test that resolves the driver class before serving traffic
When it happens
Trigger: Calling createDriver/lookupDriverClass (directly or via DevServer /playground/test-connection, where the db type comes from variables[CUBEJS_DB_TYPE]) with a type string that is neither a built-in type nor matching an installed `${dbType}-cubejs-driver` package — e.g. CUBEJS_DB_TYPE=oracle when @cubejs-backend/oracle-driver is not installed, or a mistyped value like 'postgress'.
Common situations: Typo in CUBEJS_DB_TYPE; using a database type supported only by a separate driver package that was never yarn-installed; community/custom drivers named incorrectly (must be <type>-cubejs-driver); upgrading Cube and the type moved to an external package.
Related errors
- CreateOptions.dbType was removed in v1.7.0. Use driverFactor
- Either CUBEJS_DB_TYPE or CreateOptions.driverFactory must be
- Native api gateway is not enabled
- Timezone must not be empty
- Driver's .streamQuery() method is not implemented yet.
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/13763cdd2514a9ed.
Report an issue: GitHub.