{"record":{"id":"6114d3d17c08b9e3","repo":"cube-js/cube","slug":"externaldriverfactory-is-not-provided-please-use","errorCode":null,"errorMessage":"externalDriverFactory is not provided. Please use CUBEJS_DEV_MODE=true or provide Cube Store connection env variables for production usage.","messagePattern":"externalDriverFactory is not provided\\. Please use CUBEJS_DEV_MODE=true or provide Cube Store connection env variables for production usage\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationLoadCache.ts","lineNumber":84,"sourceCode":"  protected async tablesFromCache(preAggregation, forceRenew: boolean = false) {\n    let tables = forceRenew ? null : await this.queryCache.getCacheDriver().get(this.tablesCachePrefixKey(preAggregation));\n    if (!tables) {\n      tables = await this.preAggregations.getLoadCacheQueue(this.dataSource).executeInQueue(\n        'query',\n        `Fetch tables for ${preAggregation.preAggregationsSchema}`,\n        {\n          preAggregation, requestId: this.requestId\n        },\n        0,\n        { requestId: this.requestId }\n      );\n    }\n    return tables;\n  }\n\n  public async fetchTables(preAggregation: PreAggregationDescription) {\n    if (preAggregation.external && !this.externalDriverFactory) {\n      throw new Error('externalDriverFactory is not provided. Please use CUBEJS_DEV_MODE=true or provide Cube Store connection env variables for production usage.');\n    }\n\n    const newTables = await this.fetchTablesNoCache(preAggregation);\n    await this.queryCache.getCacheDriver().set(\n      this.tablesCachePrefixKey(preAggregation),\n      newTables,\n      this.preAggregations.options.preAggregationsSchemaCacheExpire || 60 * 60\n    );\n    return newTables;\n  }\n\n  private async fetchTablesNoCache(preAggregation: PreAggregationDescription) {\n    const client = preAggregation.external ?\n      await this.externalDriverFactory() :\n      await this.driverFactory();\n\n    if (this.tablePrefixes && client.getPrefixTablesQuery && this.preAggregations.options.skipExternalCacheAndQueue) {\n      return client.getPrefixTablesQuery(preAggregation.preAggregationsSchema, this.tablePrefixes);","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationLoadCache.ts#L66-L102","documentation":"PreAggregationLoadCache.fetchTables handles pre-aggregations marked external (stored in Cube Store / external DB). If preAggregation.external is true but no externalDriverFactory was supplied to the orchestrator, it throws because there is no driver to query the external store. The message points to CUBEJS_DEV_MODE or Cube Store connection env variables.","triggerScenarios":"A query requiring an external (rolled-up to Cube Store) pre-aggregation executes while the orchestrator was constructed without externalDriverFactory — e.g. Cube Store connection env vars (CUBEJS_CUBE_STORE_*) absent and dev mode off.","commonSituations":"Production deployments missing Cube Store env configuration; custom orchestrator usage that forgot to pass externalDriverFactory; enabling external rollups in an environment where only the DB driver is configured.","solutions":["Set CUBEJS_DEV_MODE=true for local development (uses in-process Cube Store handling)","Provide Cube Store connection env variables (CUBEJS_CUBE_STORE_HOST/PORT/etc.) so the external driver factory is created","If constructing the orchestrator manually, pass an externalDriverFactory option"],"exampleFix":"// before (.env, production)\n# no Cube Store config\n// after (.env, production)\nCUBEJS_CUBE_STORE_HOST=cubestore\nCUBEJS_CUBE_STORE_PORT=3030","handlingStrategy":"validation","validationCode":"const hasCubeStore = process.env.CUBEJS_CUBE_STORE_HOST && process.env.CUBEJS_CUBE_STORE_PORT;\nif (!hasCubeStore && process.env.CUBEJS_DEV_MODE !== 'true') {\n  throw new Error('Configure Cube Store env vars or set CUBEJS_DEV_MODE=true for external pre-aggregations');\n}","typeGuard":"const externalReady = (orchestrator) => !!orchestrator?.preAggregations?.options?.externalDriverFactory || !!orchestrator?.externalDriverFactory;","tryCatchPattern":"try {\n  await loadCache.fetchTables(preAggregation);\n} catch (e) {\n  if (String(e.message).includes('externalDriverFactory is not provided')) {\n    console.error('Provide Cube Store env vars or an externalDriverFactory option');\n  }\n  throw e;\n}","preventionTips":["Set Cube Store connection env vars in all non-dev environments","When constructing the orchestrator manually, always pass externalDriverFactory if external rollups are used","Add a startup health check verifying Cube Store connectivity"],"tags":["query-orchestrator","pre-aggregations","external-driver","cubestore","configuration"],"backgroundTag":"missing-external-driver-factory","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}