{"record":{"id":"15effabce45f29ff","repo":"cube-js/cube","slug":"instance-configured-to-skip-scheduled-jobs","errorCode":null,"errorMessage":"Instance configured to skip scheduled jobs","messagePattern":"Instance configured to skip scheduled jobs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cubejs-server-core/src/core/OptsHandler.ts","lineNumber":576,"sourceCode":"      (\n        (\n          typeof this.initializedOptions.scheduledRefreshTimer === 'boolean' &&\n          this.initializedOptions.scheduledRefreshTimer\n        ) ||\n        (\n          typeof this.initializedOptions.scheduledRefreshTimer === 'number' &&\n          this.initializedOptions.scheduledRefreshTimer !== 0\n        )\n      )\n    );\n  }\n\n  /**\n   * Returns scheduled refresh interval value (in ms).\n   */\n  public getScheduledRefreshInterval(): number {\n    if (!this.configuredForScheduledRefresh()) {\n      throw new Error('Instance configured to skip scheduled jobs');\n    } else if (\n      typeof this.initializedOptions.scheduledRefreshTimer === 'number'\n    ) {\n      return parseInt(\n        `${this.initializedOptions.scheduledRefreshTimer}`, 10\n      ) * 1000;\n    } else {\n      return 30000;\n    }\n  }\n\n  /**\n   * Returns `OrchestratorInitedOptions` based on provided `OrchestratorOptions`\n   * and request context.\n   */\n  public getOrchestratorInitializedOptions(\n    context: RequestContext,\n    orchestratorOptions: OrchestratorOptions,","sourceCodeStart":558,"sourceCodeEnd":594,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-server-core/src/core/OptsHandler.ts#L558-L594","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable scheduled refresh by passing scheduledRefresh: true (or an object) in the Cube server/core options so configuredForScheduledRefresh() returns true","Guard the call: check the instance's scheduled-refresh configuration (or call configuredForScheduledRefresh()) before invoking getScheduledRefreshInterval()","If the interval is only needed when scheduling is on, wrap the call in try/catch and fall back to a default interval","Ensure init()/initApp() has run so initializedOptions.scheduledRefreshTimer is populated"],"exampleFix":"// before\nconst interval = core.getScheduledRefreshInterval();\n// after\nif (core.configuredForScheduledRefresh()) {\n  const interval = core.getScheduledRefreshInterval();\n} else {\n  const interval = 60 * 1000; // default 60s when scheduling disabled\n}","handlingStrategy":"fallback","validationCode":"function canQueryRefreshInterval(core) {\n  return typeof core.configuredForScheduledRefresh === 'function' && core.configuredForScheduledRefresh();\n}","typeGuard":"const isScheduledRefreshEnabled = (core: any): core is { getScheduledRefreshInterval: () => number } =>\n  typeof core.configuredForScheduledRefresh === 'function' && core.configuredForScheduledRefresh();","tryCatchPattern":"let interval;\ntry {\n  interval = core.getScheduledRefreshInterval();\n} catch (e) {\n  if (e.message === 'Instance configured to skip scheduled jobs') {\n    interval = 60 * 1000; // default\n  } else { throw e; }\n}","preventionTips":["Only call refresh-interval APIs when scheduledRefresh is enabled in options","Check configuredForScheduledRefresh() before querying the interval","Default the interval when scheduling is disabled instead of crashing"],"tags":["configuration","scheduler","pre-aggregations"],"backgroundTag":"scheduler-not-enabled","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}