{"record":{"id":"d95c38c0b7a55aec","repo":"Yeachan-Heo/oh-my-codex","slug":"cannot-record-a-options-status-checkpoint-for","errorCode":null,"errorMessage":"Cannot record a ${options.status} checkpoint for ${goal.id} after the aggregate ultragoal plan is complete; the terminal aggregate receipt is immutable.","messagePattern":"Cannot record a (.+?) checkpoint for (.+?) after the aggregate ultragoal plan is complete; the terminal aggregate receipt is immutable\\.","errorType":"exception","errorClass":"UltragoalError","httpStatus":null,"severity":"error","filePath":"src/ultragoal/artifacts.ts","lineNumber":1790,"sourceCode":"  next.failedAt = undefined;\n  next.failureReason = undefined;\n  clearGoalBlockerFields(next);\n  next.updatedAt = now;\n  plan.activeGoalId = next.id;\n  plan.updatedAt = now;\n  await writePlan(cwd, plan);\n  await appendLedger(cwd, { ts: now, event: 'goal_started', goalId: next.id, status: next.status, message: `Attempt ${next.attempt}` });\n  return { plan, goal: next, resumed: false, done: false };\n  });\n}\n\nexport async function checkpointUltragoal(cwd: string, options: CheckpointOptions): Promise<UltragoalPlan> {\n  return withUltragoalMutationLock(cwd, async () => {\n  const plan = await readUltragoalPlanUnderLock(cwd);\n  const goal = plan.goals.find((candidate) => candidate.id === options.goalId);\n  if (!goal) throw new UltragoalError(`Unknown ultragoal id: ${options.goalId}`);\n  if (plan.aggregateCompletion?.status === 'complete' && options.status !== 'complete') {\n    throw new UltragoalError(`Cannot record a ${options.status} checkpoint for ${goal.id} after the aggregate ultragoal plan is complete; the terminal aggregate receipt is immutable.`);\n  }\n  const now = iso(options.now);\n  if (options.status === 'blocked') {\n    if (goal.status !== 'in_progress') {\n      throw new UltragoalError(`Cannot record a blocked checkpoint for ${goal.id} while it is ${goal.status}; start or resume the ultragoal before recording a non-terminal blocker.`);\n    }\n    const snapshot = options.codexGoal === undefined ? null : parseCodexGoalSnapshot(options.codexGoal);\n    if (snapshot?.unavailableReason === 'db_schema_context_error') {\n      goal.updatedAt = now;\n      goal.failureReason = assertNonEmpty(options.evidence, '--evidence');\n      plan.activeGoalId = goal.id;\n      plan.updatedAt = now;\n      await writePlan(cwd, plan);\n      await appendLedger(cwd, {\n        ts: now,\n        event: 'goal_blocked',\n        goalId: goal.id,\n        status: goal.status,","sourceCodeStart":1772,"sourceCodeEnd":1808,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/ultragoal/artifacts.ts#L1772-L1808","documentation":"The aggregate ultragoal plan already has aggregateCompletion.status === 'complete', and you attempted to record a non-'complete' checkpoint. The terminal aggregate receipt is treated as immutable, so no further blocked/failed/in_progress checkpoints may be recorded after aggregate completion.","triggerScenarios":"Calling checkpointUltragoal with options.status of 'blocked', 'failed', or similar after plan.aggregateCompletion.status is 'complete' and the status being recorded is not 'complete'.","commonSituations":"Retrying an old blocked checkpoint after the final goal completed the plan; automated retry loops firing late; concurrent pipelines recording checkpoints after finalization.","solutions":["Do not record further non-complete checkpoints — the plan is finalized","If the late checkpoint is legitimately needed, it must be recorded before final completion or not at all","Audit your orchestration to cancel pending checkpoint jobs once aggregate completion is written"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const plan = await readUltragoalPlan(cwd);\nif (plan.aggregateCompletion?.status === 'complete' && options.status !== 'complete') skip();","typeGuard":"const isPlanFinalized = (plan: UltragoalPlan) => plan.aggregateCompletion?.status === 'complete';","tryCatchPattern":null,"preventionTips":["Cancel pending checkpoint jobs once aggregate completion is written","Treat the aggregate receipt as append-nothing: design pipelines to stop after finalization"],"tags":["ultragoal","checkpoint","immutable","terminal-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}