{"record":{"id":"5e753b58f4e6dfbd","repo":"Yeachan-Heo/oh-my-codex","slug":"autoresearch-candidate-artifact-base-commit-is-req","errorCode":null,"errorMessage":"autoresearch candidate artifact base_commit is required","messagePattern":"autoresearch candidate artifact base_commit is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/autoresearch/runtime.ts","lineNumber":1039,"sourceCode":"  let parsed: unknown;\n  try {\n    parsed = JSON.parse(raw);\n  } catch {\n    throw new Error('autoresearch candidate artifact must be valid JSON');\n  }\n  if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {\n    throw new Error('autoresearch candidate artifact must be a JSON object');\n  }\n  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  };","sourceCodeStart":1021,"sourceCodeEnd":1057,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/autoresearch/runtime.ts#L1021-L1057","documentation":"The required base_commit field must be a non-empty trimmed string. It identifies the git commit the candidate was produced against and cannot be missing, empty, or whitespace-only.","triggerScenarios":"A worker omitting base_commit, emitting an empty string, whitespace, or a non-string value when it could not determine the base commit (e.g. empty repo, detached context, or a failed git call inside the worker).","commonSituations":"Workers running in repos with no commits yet, base SHA capture failing silently and defaulting to '', or templates that skip the field on some branches.","solutions":["Have the worker capture the base commit (git rev-parse HEAD) before starting and always write it as base_commit","If the repo has no commits, create an initial empty commit so a base SHA exists","Fix worker templates so base_commit is unconditionally populated, never conditionally omitted","Fail loudly inside the worker if the base SHA cannot be read, instead of writing an empty value"],"exampleFix":"// before\n{\"status\":\"candidate\",\"candidate_commit\":\"def\",\"description\":\"...\",\"notes\":[]}\n// after\n{\"status\":\"candidate\",\"base_commit\":\"abc123\",\"candidate_commit\":\"def456\",\"description\":\"...\",\"notes\":[]}","handlingStrategy":"validation","validationCode":"function isValidBaseCommit(v: unknown): boolean {\n  return typeof v === 'string' && v.trim().length > 0;\n}\nconst parsed = JSON.parse(raw) as Record<string, unknown>;\nif (!isValidBaseCommit(parsed.base_commit)) throw new Error('artifact base_commit missing/empty');","typeGuard":"function hasBaseCommit(v: unknown): v is { base_commit: string } {\n  return typeof v === 'object' && v !== null && typeof (v as any).base_commit === 'string' && (v as any).base_commit.trim() !== '';\n}","tryCatchPattern":"try { const a = parseAutoresearchCandidateArtifact(raw); }\ncatch (e) { if (e instanceof Error && e.message.includes('base_commit is required')) { /* capture git rev-parse HEAD and repopulate the artifact */ } throw e; }","preventionTips":["Capture the base SHA (git rev-parse HEAD) in the worker before work begins","Ensure the repo has at least one commit before starting a run","Make base_commit unconditional in artifact templates"],"tags":["autoresearch","required-field","git-commit","artifact"],"backgroundTag":"required-field-missing","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}