{"record":{"id":"d08bc286e969bb62","repo":"multica-ai/multica","slug":"parse-cutoff-as-rfc3339-w","errorCode":null,"errorMessage":"parse --cutoff as RFC3339: %w","messagePattern":"parse --cutoff as RFC3339: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/backfill_codex_usage_cache/main.go","lineNumber":165,"sourceCode":"\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 = `\nSELECT\n    a.workspace_id::text AS workspace_id,\n    (tu.created_at AT TIME ZONE 'UTC')::date::text AS date_utc,\n    COUNT(*)::bigint AS rows,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/backfill_codex_usage_cache/main.go#L147-L183","documentation":"Config validation error: the --cutoff value could not be parsed as RFC3339 (time.Parse(time.RFC3339, ...)). The tool requires a full RFC3339 timestamp with timezone, e.g. 2026-06-01T12:00:00Z; date-only values, missing time, or a missing zone offset all fail here. The wrapped time.Parse error names the exact offending element.","triggerScenarios":"Passing --cutoff 2026-06-01 (date only), --cutoff '2026-06-01 12:00:00' (space separator, no zone), or a timestamp without the T separator or timezone designator.","commonSituations":"Using the output of `date` on some locales verbatim; copying a cutoff from SQL output (often no zone); treating the flag as date-valued because the dry-run summary groups by UTC date.","solutions":["Format the timestamp as RFC3339 with an explicit zone: --cutoff 2026-06-01T12:00:00Z.","Generate it programmatically: date -u +%Y-%m-%dT%H:%M:%SZ.","Read the wrapped error's detail — it states whether the T separator, hours, or timezone offset was missing."],"exampleFix":"# before\n./backfill_codex_usage_cache --cutoff 2026-06-01\n# parse --cutoff as RFC3339: ...\n\n# after\n./backfill_codex_usage_cache --cutoff $(date -u -d '2026-06-01 12:00' +%Y-%m-%dT%H:%M:%SZ)","handlingStrategy":"validation","validationCode":"# Generate a valid RFC3339 cutoff\nCUTOFF=$(date -u -d \"$DEPLOY_TIME\" +%Y-%m-%dT%H:%M:%SZ) || exit 1\n./backfill_codex_usage_cache --cutoff \"$CUTOFF\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always emit cutoffs with date -u +%Y-%m-%dT%H:%M:%SZ rather than hand-writing them.","Remember RFC3339 requires the T separator and an explicit zone (Z or ±HH:MM)."],"tags":["cli","validation","time","rfc3339","backfill"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}