{"record":{"id":"e863dc548fdb8d27","repo":"cube-js/cube","slug":"only-fixed-rolling-windows-are-supported-by-cube-s","errorCode":null,"errorMessage":"Only fixed rolling windows are supported by Cube Store but got '${type}' rolling window","messagePattern":"Only fixed rolling windows are supported by Cube Store but got '(.+?)' rolling window","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/adapter/BaseMeasure.ts","lineNumber":269,"sourceCode":"    if (this.expression) { // TODO\n      return false;\n    }\n    const definition = this.measureDefinition();\n    if (definition.multiStage) {\n      return false;\n    }\n    return definition.type === 'sum' || definition.type === 'count' || definition.type === 'countDistinctApprox' ||\n      definition.type === 'min' || definition.type === 'max';\n  }\n\n  public static isCumulative(definition): boolean {\n    return !!definition.rollingWindow;\n  }\n\n  public rollingWindowDefinition() {\n    const { type } = this.measureDefinition().rollingWindow;\n    if (type && type !== 'fixed') {\n      throw new UserError(`Only fixed rolling windows are supported by Cube Store but got '${type}' rolling window`);\n    }\n    return this.measureDefinition().rollingWindow;\n  }\n\n  public dateJoinCondition() {\n    const definition = this.measureDefinition();\n    const { rollingWindow } = definition;\n    if (rollingWindow.type === 'to_date') {\n      return this.query.rollingWindowToDateJoinCondition(rollingWindow.granularity);\n    }\n    // TODO deprecated\n    if (rollingWindow.type === 'year_to_date' || rollingWindow.type === 'quarter_to_date' || rollingWindow.type === 'month_to_date') {\n      return this.query.rollingWindowToDateJoinCondition(rollingWindow.type.replace('_to_date', ''));\n    }\n    if (rollingWindow) {\n      return this.query.rollingWindowDateJoinCondition(\n        rollingWindow.trailing, rollingWindow.leading, rollingWindow.offset\n      );","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/adapter/BaseMeasure.ts#L251-L287","documentation":"Cube Store pre-aggregations support only fixed rolling windows. rollingWindowDefinition() inspects the measure's rollingWindow.type and throws this UserError if it is 'unbounded', 'trailing', 'leading', or any other non-fixed value, because Cube Store cannot compute those window semantics in a pre-aggregation.","triggerScenarios":"Defining a measure with rollingWindow: { type: 'unbounded' | 'trailing' | 'leading', ... } and querying it in a way that plans into a Cube Store pre-aggregation (rollingWindowDefinition is called during pre-aggregation planning for rolling-window measures).","commonSituations":"Migrating rolling-window queries from Postgres-backed pre-aggregations to Cube Store; defining trailing/leading windows like 'trailing 7 days' on a Cube Store-targeted pre-aggregation; copying examples with unbounded windows into Cube Store configs.","solutions":["Change the rolling window type to 'fixed' (with a dateRange) if Cube Store pre-aggregation is required","Use a non-Cube-Store pre-aggregation target (e.g. a database that supports the window) for trailing/leading windows","Rephrase the analysis as a fixed-range query or compute trailing windows in the query layer without the pre-aggregation","Remove rollingWindow from the measure and use a calculated timeDimension range instead"],"exampleFix":"// before\nrollingWindow: { type: 'trailing', trailing: '7 day' }\n// after\nrollingWindow: { type: 'fixed', dateRange: ['2024-01-01', '2024-01-07'] }","handlingStrategy":"validation","validationCode":"function validateRollingWindow(measureDef) {\n  const rw = measureDef.rollingWindow;\n  if (rw && rw.type && rw.type !== 'fixed') {\n    throw new Error(`Rolling window type '${rw.type}' not supported by Cube Store; use 'fixed'`);\n  }\n}","typeGuard":"function hasFixedRollingWindow(def) {\n  return !def.rollingWindow || !def.rollingWindow.type || def.rollingWindow.type === 'fixed';\n}","tryCatchPattern":"try {\n  await cubeApi.load(query);\n} catch (e) {\n  if (e.message.startsWith('Only fixed rolling windows are supported')) {\n    console.error('Use fixed windows or a non-Cube-Store pre-aggregation:', e.message);\n  }\n  throw e;\n}","preventionTips":["Use rollingWindow type 'fixed' when targeting Cube Store pre-aggregations","Route trailing/unbounded window measures to database-backed pre-aggregations","Document window-type constraints in your data model style guide","Test pre-aggregation planning for every rolling-window measure"],"tags":["schema-compiler","measure","rolling-window","cube-store","pre-aggregation"],"backgroundTag":"unsupported-rolling-window-type","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}