cube-js/cube · error

Instance configured to skip scheduled jobs

Error message

Instance configured to skip scheduled jobs

What it means

Cube schedules refresh worker jobs (scheduled refresh) only when the instance is configured for them. getScheduledRefreshInterval() returns the refresh timer interval in milliseconds, but if the instance was configured to skip scheduled jobs (e.g. scheduledRefresh: false or missing scheduledRefreshTimer), there is no interval to return and the server core throws this error instead of returning a meaningless value.

Source

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

      (
        (
          typeof this.initializedOptions.scheduledRefreshTimer === 'boolean' &&
          this.initializedOptions.scheduledRefreshTimer
        ) ||
        (
          typeof this.initializedOptions.scheduledRefreshTimer === 'number' &&
          this.initializedOptions.scheduledRefreshTimer !== 0
        )
      )
    );
  }

  /**
   * Returns scheduled refresh interval value (in ms).
   */
  public getScheduledRefreshInterval(): number {
    if (!this.configuredForScheduledRefresh()) {
      throw new Error('Instance configured to skip scheduled jobs');
    } else if (
      typeof this.initializedOptions.scheduledRefreshTimer === 'number'
    ) {
      return parseInt(
        `${this.initializedOptions.scheduledRefreshTimer}`, 10
      ) * 1000;
    } else {
      return 30000;
    }
  }

  /**
   * Returns `OrchestratorInitedOptions` based on provided `OrchestratorOptions`
   * and request context.
   */
  public getOrchestratorInitializedOptions(
    context: RequestContext,
    orchestratorOptions: OrchestratorOptions,

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Enable scheduled refresh by passing scheduledRefresh: true (or an object) in the Cube server/core options so configuredForScheduledRefresh() returns true
  2. Guard the call: check the instance's scheduled-refresh configuration (or call configuredForScheduledRefresh()) before invoking getScheduledRefreshInterval()
  3. If the interval is only needed when scheduling is on, wrap the call in try/catch and fall back to a default interval
  4. Ensure init()/initApp() has run so initializedOptions.scheduledRefreshTimer is populated

Example fix

// before
const interval = core.getScheduledRefreshInterval();
// after
if (core.configuredForScheduledRefresh()) {
  const interval = core.getScheduledRefreshInterval();
} else {
  const interval = 60 * 1000; // default 60s when scheduling disabled
}
Defensive patterns

Strategy: fallback

Validate before calling

function canQueryRefreshInterval(core) {
  return typeof core.configuredForScheduledRefresh === 'function' && core.configuredForScheduledRefresh();
}

Type guard

const isScheduledRefreshEnabled = (core: any): core is { getScheduledRefreshInterval: () => number } =>
  typeof core.configuredForScheduledRefresh === 'function' && core.configuredForScheduledRefresh();

Try / catch

let interval;
try {
  interval = core.getScheduledRefreshInterval();
} catch (e) {
  if (e.message === 'Instance configured to skip scheduled jobs') {
    interval = 60 * 1000; // default
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling serverCore.getScheduledRefreshInterval() (directly or via code that queries refresh timing) on a CubeServerCore instance where configuredForScheduledRefresh() is false — i.e. scheduledRefresh was not enabled or the instance was created with options that skip scheduled jobs.

Common situations: Developers integrating the refresh scheduler manually or probing the core's refresh configuration on a dev instance without scheduledRefresh enabled; calling this API before init() or with scheduledRefresh explicitly set to false; upgrade scenarios where scheduling options moved.

Related errors


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