{"record":{"id":"2de66b15e4ada8a3","repo":"multica-ai/multica","slug":"cutoff-is-required-use-the-hosted-deployment-ti","errorCode":null,"errorMessage":"--cutoff is required; use the hosted deployment time of the Codex usage normalization fix","messagePattern":"--cutoff is required; use the hosted deployment time of the Codex usage normalization fix","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/backfill_codex_usage_cache/main.go","lineNumber":161,"sourceCode":"\trollupFrom, rollupTo := rollupWindow(updateStartedAt, updateFinishedAt)\n\tvar rollupRows int64\n\tif err := pool.QueryRow(ctx,\n\t\t`SELECT rollup_task_usage_hourly_window($1::timestamptz, $2::timestamptz)`,\n\t\trollupFrom, rollupTo,\n\t).Scan(&rollupRows); err != nil {\n\t\treturn fmt.Errorf(\"rebuild hourly rollup for update window %s..%s: %w\",\n\t\t\trollupFrom.Format(time.RFC3339), rollupTo.Format(time.RFC3339), err)\n\t}\n\tslog.Info(\"hourly rollup rebuilt\",\n\t\t\"from\", rollupFrom.Format(time.RFC3339),\n\t\t\"to\", rollupTo.Format(time.RFC3339),\n\t\t\"rows_touched\", rollupRows)\n\treturn nil\n}\n\nfunc (cfg *config) parseAndValidate(now time.Time) error {\n\tif cfg.cutoffRaw == \"\" {\n\t\treturn fmt.Errorf(\"--cutoff is required; use the hosted deployment time of the Codex usage normalization fix\")\n\t}\n\tcutoff, err := time.Parse(time.RFC3339, cfg.cutoffRaw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse --cutoff as RFC3339: %w\", err)\n\t}\n\tcutoff = cutoff.UTC()\n\tif !cutoff.Before(now) {\n\t\treturn fmt.Errorf(\"--cutoff must be before now; refusing a future cutoff because it could double-subtract already-normalized rows\")\n\t}\n\tif cfg.batchSize <= 0 {\n\t\treturn fmt.Errorf(\"--batch-size must be positive\")\n\t}\n\tcfg.cutoff = cutoff\n\treturn nil\n}\n\nfunc loadDryRunSummary(ctx context.Context, pool *pgxpool.Pool, cfg config) ([]summaryRow, totals, error) {\n\tconst query = `","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/backfill_codex_usage_cache/main.go#L143-L179","documentation":"Config validation error from the backfill tool: --cutoff was not supplied at all. The cutoff defines which Codex task_usage rows are eligible for correction (rows last touched before the cutoff), and it is mandatory because the tool refuses to guess a correction boundary — it must be the hosted deployment time of the Codex usage normalization fix.","triggerScenarios":"Invoking backfill_codex_usage_cache with no --cutoff flag, or with the flag name misspelled so it is never parsed.","commonSituations":"Copy-pasting the command from a runbook that omitted the flag; assuming the tool defaults the cutoff to 'now'; flag typos like -cutoff or --cuttoff being silently treated as unknown and ignored.","solutions":["Add --cutoff <RFC3339 timestamp> set to the hosted deployment time of the Codex usage normalization fix.","Run the tool once without --execute to see the dry-run summary for that cutoff before applying."],"exampleFix":"# before\n./backfill_codex_usage_cache\n# --cutoff is required; ...\n\n# after\n./backfill_codex_usage_cache --cutoff 2026-06-01T12:00:00Z  # dry-run first, then add --execute","handlingStrategy":"validation","validationCode":"# Guard in the runbook\nCUTOFF=${CUTOFF:?\"--cutoff (RFC3339, hosted deploy time of the Codex fix) is required\"}\n./backfill_codex_usage_cache --cutoff \"$CUTOFF\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Record the normalization fix's deployment timestamp in the incident doc and reuse it verbatim.","Always do a dry-run (omit --execute) first to validate flags against real data."],"tags":["cli","validation","backfill","flags"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}