{"record":{"id":"df1a04542be7a0c2","repo":"grafana/grafana","slug":"quickranges-is-not-an-array","errorCode":null,"errorMessage":"QuickRanges is not an array","messagePattern":"QuickRanges is not an array","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"public/app/features/dashboard-scene/serialization/transformSceneToSaveModelSchemaV2.ts","lineNumber":929,"sourceCode":"  }\n\n  // Optional time settings with defaults\n  if (\n    'autoRefreshIntervals' in timeSettings &&\n    timeSettings.autoRefreshIntervals !== undefined &&\n    !Array.isArray(timeSettings.autoRefreshIntervals)\n  ) {\n    throw new Error('AutoRefreshIntervals is not an array');\n  }\n  if ('timezone' in timeSettings && timeSettings.timezone !== undefined && typeof timeSettings.timezone !== 'string') {\n    throw new Error('Timezone is not a string');\n  }\n  if (\n    'quickRanges' in timeSettings &&\n    timeSettings.quickRanges !== undefined &&\n    !Array.isArray(timeSettings.quickRanges)\n  ) {\n    throw new Error('QuickRanges is not an array');\n  }\n  if ('weekStart' in timeSettings && timeSettings.weekStart !== undefined) {\n    if (\n      typeof timeSettings.weekStart !== 'string' ||\n      !['saturday', 'sunday', 'monday'].includes(timeSettings.weekStart)\n    ) {\n      throw new Error('WeekStart should be one of \"saturday\", \"sunday\" or \"monday\"');\n    }\n  }\n  if ('nowDelay' in timeSettings && timeSettings.nowDelay !== undefined && typeof timeSettings.nowDelay !== 'string') {\n    throw new Error('NowDelay is not a string');\n  }\n  if (\n    'fiscalYearStartMonth' in timeSettings &&\n    timeSettings.fiscalYearStartMonth !== undefined &&\n    typeof timeSettings.fiscalYearStartMonth !== 'number'\n  ) {\n    throw new Error('FiscalYearStartMonth is not a number');","sourceCodeStart":911,"sourceCodeEnd":947,"githubUrl":"https://github.com/grafana/grafana/blob/ae3104e3690e28e72c8f0c97efc12647a70f75c3/public/app/features/dashboard-scene/serialization/transformSceneToSaveModelSchemaV2.ts#L911-L947","documentation":"Thrown by validateDashboardSchemaV2 (transformSceneToSaveModelSchemaV2.ts:929) when timeSettings.quickRanges is present but not an array. quickRanges is an optional array of time-range preset definitions; a non-array aborts serialization. Only checked when the key is present and not undefined.","triggerScenarios":"validateDashboardSchemaV2 gets timeSettings whose quickRanges is a single range object or a stringified blob instead of an array; typical from imported JSON or a producer that emitted a lone range.","commonSituations":"Migration from models storing a single quick range object; API payloads with malformed quickRanges; form input not wrapped in [ ].","solutions":["Wrap a single range in [ ] or coerce with Array.isArray(x) ? x : x == null ? undefined : [x].","Omit the key when there are no quick ranges so the optional branch is skipped."],"exampleFix":"// before\nconst ts = { ...timeSettings, quickRanges: source.defaultRange };\n// after\nconst raw = source.defaultRange;\nconst ts = { ...timeSettings, quickRanges: raw == null ? undefined : Array.isArray(raw) ? raw : [raw] };","handlingStrategy":"validation","validationCode":"if ('quickRanges' in (dash.timeSettings ?? {}) && dash.timeSettings.quickRanges !== undefined && !Array.isArray(dash.timeSettings.quickRanges)) {\n  throw new Error('timeSettings.quickRanges must be an array');\n}","typeGuard":"function isQuickRangeArray(v: unknown): v is unknown[] { return Array.isArray(v); }","tryCatchPattern":"try {\n  validateDashboardSchemaV2(dash);\n} catch (e) {\n  if (String(e).includes('QuickRanges')) { const r = dash.timeSettings.quickRanges; dash.timeSettings.quickRanges = Array.isArray(r) ? r : r == null ? undefined : [r]; validateDashboardSchemaV2(dash); }\n  else throw e;\n}","preventionTips":["Wrap a single quick range in [ ].","Omit the key when there are no quick ranges.","Validate imported JSON shape before serialization."],"tags":["validation","dashboard-schema-v2","time-settings","array"],"backgroundTag":null,"analyzedSha":"ae3104e3690e28e72c8f0c97efc12647a70f75c3","analyzedAt":"2026-08-12T12:48:38.752Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}