{"record":{"id":"ed6e2dced13c677d","repo":"Yeachan-Heo/oh-my-codex","slug":"autoresearch-candidate-artifact-created-at-is-requ","errorCode":null,"errorMessage":"autoresearch candidate artifact created_at is required","messagePattern":"autoresearch candidate artifact created_at is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/autoresearch/runtime.ts","lineNumber":1048,"sourceCode":"  const record = parsed as Record<string, unknown>;\n  const status = record.status;\n  if (status !== 'candidate' && status !== 'noop' && status !== 'abort' && status !== 'interrupted') {\n    throw new Error('autoresearch candidate artifact status must be candidate|noop|abort|interrupted');\n  }\n  if (record.candidate_commit !== null && typeof record.candidate_commit !== 'string') {\n    throw new Error('autoresearch candidate artifact candidate_commit must be string|null');\n  }\n  if (typeof record.base_commit !== 'string' || !record.base_commit.trim()) {\n    throw new Error('autoresearch candidate artifact base_commit is required');\n  }\n  if (typeof record.description !== 'string') {\n    throw new Error('autoresearch candidate artifact description is required');\n  }\n  if (!Array.isArray(record.notes) || record.notes.some((note) => typeof note !== 'string')) {\n    throw new Error('autoresearch candidate artifact notes must be a string array');\n  }\n  if (typeof record.created_at !== 'string' || !record.created_at.trim()) {\n    throw new Error('autoresearch candidate artifact created_at is required');\n  }\n  return {\n    status,\n    candidate_commit: record.candidate_commit,\n    base_commit: record.base_commit,\n    description: record.description,\n    notes: record.notes,\n    created_at: record.created_at,\n  };\n}\n\nasync function readCandidateArtifact(candidateFile: string): Promise<AutoresearchCandidateArtifact> {\n  if (!existsSync(candidateFile)) {\n    throw new Error(`autoresearch_candidate_missing:${candidateFile}`);\n  }\n  return parseAutoresearchCandidateArtifact(await readFile(candidateFile, 'utf-8'));\n}\n","sourceCodeStart":1030,"sourceCodeEnd":1066,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/autoresearch/runtime.ts#L1030-L1066","documentation":"The candidate artifact validator requires a 'created_at' timestamp as a non-empty string. This error fires when created_at is absent, not a string, or a whitespace-only string. It guarantees every candidate artifact carries a creation timestamp for ordering and audit.","triggerScenarios":"parseAutoresearchCandidateArtifact on JSON where 'created_at' is missing, null, a number (epoch), or an empty/whitespace string.","commonSituations":"Generators writing epoch numbers instead of ISO strings, hand-authored artifacts omitting the field, or a truncated/interrupted run that wrote an incomplete file.","solutions":["Open the candidate artifact and add created_at as an ISO 8601 string, e.g. new Date().toISOString()","Fix the producer to always set created_at before writing the file","If the file is truncated from an interrupted run, delete it and re-run the autoresearch session instead of patching"],"exampleFix":"// before\n{\"status\":\"candidate\",\"created_at\":1735689600000}\n\n// after\n{\"status\":\"candidate\",\"created_at\":\"2025-01-01T00:00:00.000Z\"}","handlingStrategy":"validation","validationCode":"const raw = JSON.parse(text);\nif (typeof raw.created_at !== 'string' || !raw.created_at.trim()) {\n  raw.created_at = new Date().toISOString(); // or reject upstream\n}","typeGuard":"function hasCreatedAt(v: unknown): v is { created_at: string } {\n  return typeof v === 'object' && v !== null && typeof (v as any).created_at === 'string' && (v as any).created_at.trim() !== '';\n}","tryCatchPattern":null,"preventionTips":["Serialize timestamps with toISOString() at write time","Treat missing created_at as a corrupt artifact and re-run the session"],"tags":["autoresearch","json","validation","timestamp"],"backgroundTag":"schema-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}