cube-js/cube · error · Error

CreateOptions.orchestratorOptions.rollupOnlyMode cannot be t

Error message

CreateOptions.orchestratorOptions.rollupOnlyMode cannot be trusly for API instance if CUBEJS_PRE_AGGREGATIONS_BUILDER is set to true

What it means

asserOrchestratorOptions rejects an invalid combination of scheduling flags: on an API instance (isApiWorker) when CUBEJS_PRE_AGGREGATIONS_BUILDER=true, orchestratorOptions.rollupOnlyMode must not be truthy. rollupOnlyMode makes the orchestrator only serve pre-built rollups, which conflicts with this instance also acting as the pre-aggregations builder. The error message contains a typo ('trusly' for 'truthy').

Source

Thrown at packages/cubejs-server-core/src/core/OptsHandler.ts:140

        `DriverConfig or driver instance: <${
          typeof val
        }>${
          JSON.stringify(val, undefined, 2)
        }`
      );
    }
  }

  /**
   * Assert orchestration options.
   */
  private asserOrchestratorOptions(opts: OrchestratorOptions) {
    if (
      opts.rollupOnlyMode &&
      this.isApiWorker() &&
      getEnv('preAggregationsBuilder')
    ) {
      throw new Error(
        'CreateOptions.orchestratorOptions.rollupOnlyMode cannot be trusly ' +
        'for API instance if CUBEJS_PRE_AGGREGATIONS_BUILDER is set to true'
      );
    }
  }

  /**
   * Default database factory function.
   */
  private defaultDriverFactory(ctx: DriverContext): DriverConfig {
    const type = <DatabaseType>getEnv('dbType', {
      dataSource: assertDataSource(ctx.dataSource),
      preAggregations: ctx.preAggregations,
    });

    return { type };
  }

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Remove rollupOnlyMode from the API instance's orchestratorOptions
  2. Or unset CUBEJS_PRE_AGGREGATIONS_BUILDER if this instance shouldn't build pre-aggregations
  3. Separate createOptions per role: keep rollupOnlyMode only on store/worker instances that are not the builder
  4. Review the deployment topology so builder and rollup-only roles don't overlap

Example fix

// before
create({ orchestratorOptions: { rollupOnlyMode: true } }) // with CUBEJS_PRE_AGGREGATIONS_BUILDER=true
// after
create({ orchestratorOptions: { rollupOnlyMode: false } }) // builder role, or remove the env var on rollup-only workers
Defensive patterns

Strategy: validation

Validate before calling

function assertRollupConfigValid(orchestratorOptions = {}) {
  const builder = process.env.CUBEJS_PRE_AGGREGATIONS_BUILDER === 'true';
  if (builder && orchestratorOptions.rollupOnlyMode) {
    throw new Error('rollupOnlyMode cannot be truthy on the API instance while CUBEJS_PRE_AGGREGATIONS_BUILDER=true');
  }
}
assertRollupConfigValid(createOptions.orchestratorOptions);

Type guard

function hasValidRollupRoles(opts) {
  const builder = process.env.CUBEJS_PRE_AGGREGATIONS_BUILDER === 'true';
  return !(builder && opts && opts.orchestratorOptions && opts.orchestratorOptions.rollupOnlyMode);
}

Try / catch

try {
  await create(opts);
} catch (e) {
  if (e.message.includes('rollupOnlyMode cannot be')) {
    console.error('Role conflict: either disable rollupOnlyMode here or unset CUBEJS_PRE_AGGREGATIONS_BUILDER.');
  }
  throw e;
}

Prevention

When it happens

Trigger: Starting the server with CUBEJS_PRE_AGGREGATIONS_BUILDER=true in the environment while passing createOptions.orchestratorOptions.rollupOnlyMode: true for the API worker role.

Common situations: Copy-pasting rollupOnlyMode configs meant for store/orchestrator workers into the API instance; enabling pre-aggregations builder globally in docker-compose while all services share the same createOptions; multi-instance deployments misassigning roles.

Related errors


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