{"record":{"id":"9fd580daca40906d","repo":"coleam00/Archon","slug":"cannot-confirm-the-isolation-container-owned-by-ru","errorCode":null,"errorMessage":"Cannot confirm the isolation container owned by run ${resolvedId}. The run was not changed; its container tracking ID is missing.","messagePattern":"Cannot confirm the isolation container owned by run (.+?)\\. The run was not changed; its container tracking ID is missing\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":4404,"sourceCode":"    resolvedId: string;\n    workflowName: string;\n    cascadeFailures: number;\n    blockedParentRunId: string | null;\n  }> => {\n    const resolvedId = await resolveRunIdArg(runId, cwd);\n    const current = await workflowDb.getWorkflowRun(resolvedId);\n    if (!current) throw new Error(`Workflow run not found: ${resolvedId}`);\n    if (current.status !== 'running') {\n      throw new Error(\n        `Cannot actively cancel run with status '${current.status}'. Only a running detached CLI run has live work to stop.`\n      );\n    }\n\n    let containerEnvId: string | undefined;\n    if (current.metadata?.isolation === 'container') {\n      const isolationEnvId = current.metadata.isolation_env_id;\n      if (typeof isolationEnvId !== 'string' || isolationEnvId.trim().length === 0) {\n        throw new Error(\n          `Cannot confirm the isolation container owned by run ${resolvedId}. ` +\n            'The run was not changed; its container tracking ID is missing.'\n        );\n      }\n      containerEnvId = isolationEnvId;\n      const containerEnv = await isolationDb.getById(containerEnvId);\n      if (containerEnv?.provider !== 'container') {\n        throw new Error(\n          `Cannot confirm the isolation container owned by run ${resolvedId}. ` +\n            'The run was not changed; inspect the managed containers before retrying or abandoning it.'\n        );\n      }\n    }\n\n    const target = await requestDetachedRunStop(resolvedId);\n    await target.stop();\n\n    if (containerEnvId) {","sourceCodeStart":4386,"sourceCodeEnd":4422,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L4386-L4422","documentation":"When actively cancelling a run isolated in a container, the CLI must know which managed container to confirm/stop. If the run's metadata says `isolation: 'container'` but `isolation_env_id` is missing or blank, the run is deliberately left unchanged because proceeding could orphan the container.","triggerScenarios":"Cancelling a container-isolated run whose row metadata lacks `isolation_env_id` (older run predating container tracking, or corrupted metadata).","commonSituations":"Runs created before isolation tracking shipped; metadata lost through manual DB edits or partial restores; container was provisioned outside Archon's tracking.","solutions":["Inspect the run's metadata and the isolation DB to locate the container manually (`isolationDb.getById`)","Stop/reclaim the container through the isolation tooling, then cancel the run once its tracking is consistent","If the container is already gone, repair or clear the run's isolation metadata on a scratch DB before cancelling"],"exampleFix":"// before\nawait cancelWorkflow(runId); // throws: missing isolation_env_id\n// after\nconst run = await getWorkflowRun(runId);\nif (run.metadata?.isolation === 'container' && !run.metadata?.isolation_env_id) {\n  console.error('run has container isolation but no tracking ID; inspect managed containers first');\n} else { await cancelWorkflow(runId); }","handlingStrategy":"validation","validationCode":"const run = await workflowDb.getWorkflowRun(id);\nif (run.metadata?.isolation === 'container' &&\n    (typeof run.metadata?.isolation_env_id !== 'string' || !run.metadata.isolation_env_id.trim())) {\n  throw new Error('container-isolated run is missing isolation_env_id; inspect managed containers first');\n}","typeGuard":"function hasContainerTracking(m: RunMetadata | undefined): m is RunMetadata & { isolation: 'container'; isolation_env_id: string } {\n  return m?.isolation === 'container' && typeof m.isolation_env_id === 'string' && m.isolation_env_id.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Don't manually edit run metadata","Upgrade runs created before container tracking rather than cancelling them blindly","Audit container-isolated runs for missing isolation_env_id before batch cancels"],"tags":["cli","workflow","cancel","container","metadata-missing"],"backgroundTag":"missing-container-tracking-id","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}