{"record":{"id":"1ec3099abbff2452","repo":"cube-js/cube","slug":"no-pre-aggregation-partitions-were-built-yet-for-t-1ec309","errorCode":null,"errorMessage":"No pre-aggregation partitions were built yet for the pre-aggregation serving this query and this API instance wasn't set up to build pre-aggregations. Please make sure your refresh worker is configured correctly, running, pre-aggregation tables are built and all pre-aggregation refresh settings like timezone match. Expected table name patterns: ${expectedTableNames.join(', ')}","messagePattern":"No pre-aggregation partitions were built yet for the pre-aggregation serving this query and this API instance wasn't set up to build pre-aggregations\\. Please make sure your refresh worker is configured correctly, running, pre-aggregation tables are built and all pre-aggregation refresh settings like timezone match\\. Expected table name patterns: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationPartitionRangeLoader.ts","lineNumber":255,"sourceCode":"            ...result,\n            partitionRange: partitionRanges[i]\n          };\n        }));\n        return { loadResults: resolveResults.filter(res => res !== null), partitionLoaders };\n      };\n\n      // eslint-disable-next-line prefer-const\n      let loadResultAndLoaders = await loadPreAggregationsByPartitionRanges(await this.partitionRanges());\n      if (this.options.externalRefresh && loadResultAndLoaders.loadResults.length === 0) {\n        loadResultAndLoaders = await loadPreAggregationsByPartitionRanges(await this.partitionRanges(true));\n        // In case there are no partitions ready at matched time dimension intersection then no data can be retrieved.\n        // We need to provide any table so query can just execute successfully.\n        if (loadResultAndLoaders.loadResults.length > 0) {\n          loadResultAndLoaders.loadResults = [loadResultAndLoaders.loadResults[loadResultAndLoaders.loadResults.length - 1]];\n        }\n      }\n      if (this.options.externalRefresh && loadResultAndLoaders.loadResults.length === 0) {\n        throw new Error(\n          // eslint-disable-next-line no-use-before-define\n          PreAggregations.noPreAggregationPartitionsBuiltMessage(loadResultAndLoaders.partitionLoaders.map(p => p.preAggregation))\n        );\n      }\n\n      let { loadResults } = loadResultAndLoaders;\n\n      let lambdaTable: InlineTable;\n      let emptyResult = false;\n\n      if (this.preAggregation.rollupLambdaId) {\n        if (this.lambdaQuery && loadResults.length > 0) {\n          const { buildRangeEnd, targetTableName } = loadResults[loadResults.length - 1];\n          const lambdaTypes = await this.loadCache.getTableColumnTypes(this.preAggregation, targetTableName);\n          lambdaTable = await this.downloadLambdaTable(buildRangeEnd, lambdaTypes);\n        }\n        const rollupLambdaResults = this.preAggregationsTablesToTempTables.filter(tempTableResult => tempTableResult[1].rollupLambdaId === this.preAggregation.rollupLambdaId);\n        const filteredResults = loadResults.filter(","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-query-orchestrator/src/orchestrator/PreAggregationPartitionRangeLoader.ts#L237-L273","documentation":"In PreAggregationPartitionRangeLoader.loadPreAggregations, when externalRefresh is true the instance only serves partitions built by the refresh worker. If the loaded results list is empty (no partitions found for any partition loader), it throws the same 'no partitions built yet' guidance message, listing the expected table name patterns so the user can compare against what was actually built.","triggerScenarios":"Querying a partitioned pre-aggregation with externalRefresh=true when the refresh worker hasn't built any matching partitions; all built partitions are outside the query's date range; expected table names differ due to timezone/granularity/definition drift.","commonSituations":"Refresh worker missing/misconfigured in serverless deployments; query time range extending beyond built partitions (e.g., querying today when worker builds only through yesterday); mismatched timezone settings between build and query; new pre-aggregation added but never built.","solutions":["Verify the refresh worker is configured and running, and that it built partitions covering the queried range.","Compare the expected table name patterns in the error with actual tables in the store; rebuild if definitions changed.","Ensure timezone and dateRangeAlign/granularity settings match between the refresh worker and queries.","Expand the query's date range to intersect built partitions, or configure the worker to build through now.","Set externalRefresh=false on this instance if it should build pre-aggregations on demand instead."],"exampleFix":"// before\ncheckAuthLock: query with externalRefresh and no worker\n// after\n// schedule refresh in cube.js server\napp.listen(...); // plus\npreAggregationsSchema: [{ ... scheduledRefresh: true }] and running refresh worker","handlingStrategy":"try-catch","validationCode":"const tables = await externalDriver.tables();\nconst expected = expectedTableNames();\nif (externalRefresh && !expected.some(p => tables.some(t => t.startsWith(p)))) {\n  throw new Error('Refresh worker has not built partitions for this query range');\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await partitionRangeLoader.loadPreAggregations();\n} catch (e) {\n  if (String(e.message).includes('No pre-aggregation partitions were built yet')) {\n    // ensure refresh worker coverage for the query's date range, then retry once\n  }\n  throw e;\n}","preventionTips":["Schedule the refresh worker before enabling externalRefresh.","Ensure partition builds cover the full queried date range (rolling windows).","Match timezone and granularity across build and query sides.","Monitor 'expected table name patterns' alerts in logs."],"tags":["pre-aggregation","partitioned","refresh-worker","external-refresh"],"backgroundTag":"no-preaggregation-partitions-built","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}