{"record":{"id":"edc2a4e4f03eb097","repo":"coleam00/Archon","slug":"unreadablegatemessage-run-attention-approval-edc2a4","errorCode":null,"errorMessage":"unreadableGateMessage(run, attention, approval) — one of: \"Run ${run.id} has an unrecognized gate type '${String(approval?.type)}'. This Archon build cannot resolve it.\" | \"Run ${run.id} cannot be resolved: ${attention.detail}.\"","messagePattern":"unreadableGateMessage\\(run, attention, approval\\) — one of: \"Run (.+?) has an unrecognized gate type '(.+?)'\\. This Archon build cannot resolve it\\.\" \\| \"Run (.+?) cannot be resolved: (.+?)\\.\"","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/operations/workflow-operations.ts","lineNumber":360,"sourceCode":"  const attention = runAttention(run);\n  switch (attention?.kind) {\n    case 'blocked_on_child':\n      // Same redirect as assertApprovable: the parent's pause is not a rejectable\n      // gate — cancelling the parent here would silently orphan the still-paused\n      // child run. Reject the child (its own gate) or abandon the parent (which\n      // cascade-cancels the subtree) instead.\n      throw new Error(\n        `Run ${run.id} is paused waiting on sub-run ${attention.childRunId} ` +\n          `('workflow:' node '${attention.nodeId}'). Reject the child run instead` +\n          `: /workflow reject ${attention.childRunId}` +\n          ' To discard the whole tree, abandon this run.'\n      );\n    case 'unreadable':\n      // The one deliberate divergence from approve: unreadable gate METADATA is\n      // still rejectable (see this function's doc comment). An unrecognized gate\n      // TYPE is not, and neither is a block pointer with nothing to follow.\n      if (attention.reason === 'malformed_gate') break;\n      throw new Error(unreadableGateMessage(run, attention, approval));\n    case undefined:\n      if (approval && isGateResolved(approval)) {\n        throw new Error(\n          `Workflow run ${run.id} was already ${String(approval.resolved)} and is awaiting resume.`\n        );\n      }\n      break;\n    case 'awaiting_response':\n    case 'terminal':\n      // 'terminal' is unreachable: the status guard above already returned for it.\n      break;\n  }\n  return approval;\n}\n\n// ---------------------------------------------------------------------------\n// Operations\n// ---------------------------------------------------------------------------","sourceCodeStart":342,"sourceCodeEnd":378,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/operations/workflow-operations.ts#L342-L378","documentation":"assertRejectable deliberately allows rejecting runs whose gate METADATA is malformed (so operators can discard broken runs), but two cases are still fatal: an unrecognized gate 'type' from a newer/older Archon build, and an unreadable block pointer with nothing to follow. unreadableGateMessage renders the appropriate variant.","triggerScenarios":"Rejecting a paused run whose approval metadata has attention.reason other than 'malformed_gate' — either approval.type is not recognized by this build, or the block pointer is unreadable/unfollowable.","commonSituations":"A database written by a newer Archon version carries a gate type this binary does not know (downgrade or mixed-version deployment); approval metadata was corrupted or hand-edited; a partially-written block pointer leaves no resolvable target.","solutions":["Upgrade (or align) the Archon binary to the version that wrote the gate type so it can resolve the approval.","If the run should simply be discarded, use abandonWorkflow instead of reject — it does not require a readable gate.","Inspect run.metadata.approval to see the unrecognized 'type' value and confirm which build produced it.","Recover the run from a backup or re-run the workflow if metadata is corrupt."],"exampleFix":"// before\nawait workflowRejectCommand({ runId }); // throws on unrecognized gate type\n// after\nconst type = run.metadata?.approval?.type;\nif (type === 'approval') {\n  await workflowRejectCommand({ runId });\n} else {\n  await abandonWorkflow(runId); // discard unresolvable gate\n}","handlingStrategy":"type-guard","validationCode":"const KNOWN_TYPES = ['approval'];\nconst t = run.metadata?.approval?.type;\nif (t && !KNOWN_TYPES.includes(t)) console.warn(`Unknown gate type ${t}; abandon instead`);","typeGuard":"function hasKnownGateType(a: unknown): a is { type: string } {\n  return !!a && typeof a === 'object' && typeof (a as any).type === 'string' && (a as any).type === 'approval';\n}","tryCatchPattern":"try { await workflowRejectCommand({ runId }); }\ncatch (e) {\n  if ((e as Error).message.includes(\"unrecognized gate type\")) {\n    await abandonWorkflow(runId); // discard unresolvable gate\n  } else throw e;\n}","preventionTips":["Keep all Archon binaries in a deployment on the same version to avoid unknown gate types.","Never hand-edit run metadata approval blobs.","Prefer abandon for runs with corrupt or unreadable gate metadata."],"tags":["workflow","approval-gate","metadata","version-compatibility"],"backgroundTag":"unrecognized-gate-type","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}