cube-js/cube · error

No pre-aggregation table has been built for this query yet.

Error message

No pre-aggregation table has been built for this query yet. Please check your refresh worker configuration if it persists.

What it means

A rollup-only-mode guard in QueryOrchestrator.fetchQuery: with rollupOnlyMode enabled, queries must be answered exclusively from pre-aggregations, and the executed query produced zero used pre-aggregation tables. This means no pre-aggregation matched the query (or none has been built yet for it). If the error persists it indicates the refresh worker is not building the pre-aggregations the queries need.

Source

Thrown at packages/cubejs-query-orchestrator/src/orchestrator/QueryOrchestrator.ts:241

    }

    const usedPreAggregations = R.pipe<
      PreAggTableToTempTable[],
      Record<string, TempTable>,
      Record<string, unknown>
    >(
      R.fromPairs,
      R.mapObjIndexed((pa: TempTable) => ({
        targetTableName: pa.targetTableName,
        refreshKeyValues: pa.refreshKeyValues,
        lastUpdatedAt: pa.lastUpdatedAt,
        preAggregationId: pa.preAggregationId,
        type: pa.type,
      })),
    )(preAggregationsTablesToTempTables);

    if (this.rollupOnlyMode && Object.keys(usedPreAggregations).length === 0) {
      throw new Error(
        'No pre-aggregation table has been built for this query yet. ' +
        'Please check your refresh worker configuration if it persists.'
      );
    }

    let lastRefreshTimestamp = getLastUpdatedAtTimestamp(
      preAggregationsTablesToTempTables.map(pa => pa[1].lastUpdatedAt)
    );

    if (!queryBody.query) {
      // We want to return a more convenient and filled object for the following
      // processing for a jobed build query (initialized by the
      // /cubejs-system/v1/pre-aggregations/jobs endpoint).
      if (queryBody.isJob) {
        return preAggregationsTablesToTempTables.map((pa) => ({
          preAggregation: pa[1].preAggregationId || queryBody.preAggregations[0].preAggregationId,
          tableName: pa[0],
          ...pa[1],

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Check the refresh worker configuration: in rollupOnlyMode the pre-aggregation must be built by a separate refresh worker before queries arrive
  2. Ensure the pre-aggregation build actually succeeded (inspect refresh job logs / system tables) and that the worker shares the same Cube Store and schema
  3. Verify rollupOnlyMode (CUBEJS_ROLLUP_ONLY) is not enabled unintentionally — a full (non-rollup-only) node can build pre-aggregations on demand
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-query-orchestrator/src/orchestrator/QueryOrchestrator.ts:241 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/938052c3f95cb068. Report an issue: GitHub.