{"record":{"id":"aad02bb42d63c241","repo":"cube-js/cube","slug":"contexttodatasourceid-has-been-deprecated-and-remo","errorCode":null,"errorMessage":"contextToDataSourceId has been deprecated and removed. Use contextToOrchestratorId instead.","messagePattern":"contextToDataSourceId has been deprecated and removed\\. Use contextToOrchestratorId instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-server-core/src/core/server.ts","lineNumber":220,"sourceCode":"    this.scheduledRefreshTimeZones = wrapToFnIfNeeded(this.options.scheduledRefreshTimeZones || []);\n\n    this.compilerCache = new LRUCache<string, CompilerApi>({\n      max: this.options.compilerCacheSize || 250,\n      ttl: this.options.maxCompilerCacheKeepAlive,\n      updateAgeOnGet: this.options.updateCompilerCacheKeepAlive,\n      // needed to clear the setInterval timer for proactive cache internal cleanups\n      dispose: (v) => v.dispose(),\n    });\n\n    if (this.options.contextToAppId) {\n      this.contextToAppId = this.options.contextToAppId;\n      this.standalone = false;\n    }\n\n    this.contextAcceptor = this.createContextAcceptor();\n\n    if (this.options.contextToDataSourceId) {\n      throw new Error('contextToDataSourceId has been deprecated and removed. Use contextToOrchestratorId instead.');\n    }\n\n    this.contextToOrchestratorId = this.options.contextToOrchestratorId || (() => 'STANDALONE');\n    this.contextToCubeStoreRouterId = this.options.contextToCubeStoreRouterId;\n\n    // proactively free up old cache values occasionally\n    if (this.options.maxCompilerCacheKeepAlive) {\n      this.maxCompilerCacheKeep = setInterval(\n        () => this.compilerCache.purgeStale(),\n        this.options.maxCompilerCacheKeepAlive\n      );\n    }\n\n    this.startScheduledRefreshTimer();\n\n    this.event = async (event, props: LoggerFnParams) => {\n      if (!this.options.telemetry) {\n        return;","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/server.ts#L202-L238","documentation":"The contextToDataSourceId option was deprecated and removed from Cube Server. Its constructor now hard-fails if that option is present, directing users to contextToOrchestratorId, which controls per-context orchestrator (and implicitly data source) routing.","triggerScenarios":"Passing contextToDataSourceId in the options object when constructing the Cube server core (new CubeServer / CubeCore), typically carried over from an older codebase.","commonSituations":"Upgrading Cube from a version where contextToDataSourceId was valid; copy-pasted config from old examples or blog posts; multi-tenant setups that routed orchestrators per data source via the old hook.","solutions":["Remove contextToDataSourceId from the server options","Implement contextToOrchestratorId(options) returning a stable per-context/per-tenant orchestrator id instead","If data source routing is needed, return a data-source-derived id from contextToOrchestratorId","Consult the Cube docs on multi-tenancy for the current recommended pattern"],"exampleFix":"// before\nnew CubeServer({\n  contextToDataSourceId: (ctx) => ctx.tenantId\n});\n// after\nnew CubeServer({\n  contextToOrchestratorId: (ctx) => ctx.tenantId\n});","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["deprecation","configuration","multi-tenancy"],"backgroundTag":"removed-api-option","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}