{"record":{"id":"1096cc85cc8faebc","repo":"cube-js/cube","slug":"dialect-for-queryoptions-externaldbtype-is-no","errorCode":null,"errorMessage":"Dialect for '${queryOptions.externalDbType}' is not found","messagePattern":"Dialect for '(.+?)' is not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/adapter/QueryBuilder.ts","lineNumber":53,"sourceCode":"  hive: HiveQuery,\n  oracle: OracleQuery,\n  sqlite: SqliteQuery,\n  materialize: PostgresQuery,\n  cubestore: CubeStoreQuery,\n};\n\nexport const queryClass = (dbType: string, dialectClass) => dialectClass || ADAPTERS[dbType];\n\nexport const createQuery = (compilers, dbType: string, queryOptions: any) => {\n  if (!queryOptions.dialectClass && !ADAPTERS[dbType]) {\n    return null;\n  }\n\n  let externalQueryClass = queryOptions.externalDialectClass;\n\n  if (!externalQueryClass && queryOptions.externalDbType) {\n    if (!ADAPTERS[queryOptions.externalDbType]) {\n      throw new Error(`Dialect for '${queryOptions.externalDbType}' is not found`);\n    }\n\n    externalQueryClass = ADAPTERS[queryOptions.externalDbType];\n  }\n\n  return new (queryClass(dbType, queryOptions.dialectClass))(compilers, {\n    ...queryOptions,\n    externalQueryClass,\n  });\n};\n","sourceCodeStart":35,"sourceCodeEnd":64,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/adapter/QueryBuilder.ts#L35-L64","documentation":"When compiling an external (pre-aggregation rollup) query, Cube looks up the driver class for externalDbType in the built-in ADAPTERS registry. If externalDialectClass is not provided and externalDbType is not a known key, the factory throws this error because it has no query class to instantiate for the external store.","triggerScenarios":"Passing queryOptions.externalDbType whose value has no entry in ADAPTERS (typo like 'postgres ' or a custom/unregistered db type) while not supplying externalDialectClass via compilerApi/prepareCompiler options.","commonSituations":"Configuring a custom pre-aggregation store (e.g. DuckDB/ClickHouse) with a misspelled externalDbType; upgrading Cube where a dialect was renamed or removed; forgetting externalDialectClass when using a non-registered external database.","solutions":["Correct the externalDbType string to a registered adapter name (check ADAPTERS keys in adapter/QueryBuilder.ts)","Provide queryOptions.externalDialectClass with your own query class for the external db","Verify the driver package for the external database is installed and the db type is supported in your Cube version"],"exampleFix":"// before\ncreateQuery(compilers, { ...options, externalDbType: 'postgres ' });\n// after\ncreateQuery(compilers, { ...options, externalDbType: 'postgres' }); // or supply externalDialectClass","handlingStrategy":"validation","validationCode":"import { ADAPTERS } from './adapter/QueryBuilder';\nif (opts.externalDbType && !opts.externalDialectClass && !ADAPTERS[opts.externalDbType]) throw new Error(`Unsupported externalDbType: ${opts.externalDbType}`);","typeGuard":null,"tryCatchPattern":"try { return createQuery(compilers, options); } catch (e) { if (/Dialect for '.*' is not found/.test(e.message)) { console.error('Known dbTypes:', Object.keys(ADAPTERS)); } throw e; }","preventionTips":["Copy externalDbType values from documented adapter names, never by hand-typing","Supply externalDialectClass for custom external stores","Add startup-time config validation of db types"],"tags":["dialect","pre-aggregations","configuration"],"backgroundTag":"unknown-dialect","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}