{"record":{"id":"fbc68ffc0f948aef","repo":"cube-js/cube","slug":"undefined-dbtype-or-dialectclass-for-cube","errorCode":null,"errorMessage":"Undefined dbType or dialectClass for '${cube}'","messagePattern":"Undefined dbType or dialectClass for '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/adapter/QueryFactory.ts","lineNumber":13,"sourceCode":"export class QueryFactory {\n  public constructor(\n    private cubeToQueryClass: Record<string, any>,\n  ) {\n  }\n\n  public createQuery(cube: string, compilers: any, queryOptions: any) {\n    if (!(cube in this.cubeToQueryClass)) {\n      throw new Error(`Undefined cube '${cube}'`);\n    }\n    const QueryClass = this.cubeToQueryClass[cube];\n    if (!QueryClass) {\n      throw new Error(`Undefined dbType or dialectClass for '${cube}'`);\n    }\n    return new QueryClass(compilers, queryOptions);\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/adapter/QueryFactory.ts#L1-L18","documentation":"The cube name exists in the factory map but maps to a falsy QueryClass (undefined). This happens when the cube's dbType is missing/unknown and no dialectClass was provided, so the factory registered a null mapping and cannot instantiate a query.","triggerScenarios":"createQuery(cube, ...) where the cube was registered with an undefined query class — typically because the cube's dataSource/dbType is not recognized by ADAPTERS and queryOptions.dialectClass was not supplied.","commonSituations":"Schema cube declares an unsupported or misspelled sql/dbType; custom dialect expected via dialectClass but not passed in compiler options; driver package not registered before compiling.","solutions":["Set a valid dbType for the cube in your data model (one supported by ADAPTERS)","Pass queryOptions.dialectClass with a custom query class if using a custom dialect","Check driver registration / imports so the adapter for the dbType is available"],"exampleFix":"// before\ncube('Events', { sql: ..., /* dbType missing or unsupported */ });\n// after\ncube('Events', { sql: ..., dataSource: 'default' }); // with driver/dbType registered, or pass dialectClass","handlingStrategy":"validation","validationCode":"if (cube in cubeToQueryClass && !cubeToQueryClass[cube]) throw new Error(`Cube '${cube}' has no resolvable dbType/dialect; set dbType or dialectClass`);","typeGuard":null,"tryCatchPattern":"try { return factory.createQuery(cube, compilers, options); } catch (e) { if (/Undefined dbType or dialectClass/.test(e.message)) { /* prompt for dialectClass or fix dbType */ } throw e; }","preventionTips":["Always declare dataSource/dbType explicitly in cube definitions","Register custom dialects before schema compilation","Include a smoke test compiling every cube"],"tags":["dbtype","dialect","configuration"],"backgroundTag":"missing-dbtype","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}