{"record":{"id":"e0cb211cab1ddb08","repo":"coleam00/Archon","slug":"cannot-confirm-the-isolation-container-owned-by-ru-e0cb21","errorCode":null,"errorMessage":"Cannot confirm the isolation container owned by run ${resolvedId}. The run was not changed; inspect the managed containers before retrying or abandoning it.","messagePattern":"Cannot confirm the isolation container owned by run (.+?)\\. The run was not changed; inspect the managed containers before retrying or abandoning it\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":4412,"sourceCode":"    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) {\n      try {\n        await reclaimContainerEnv(containerEnvId);\n      } catch (error) {\n        throw new Error(\n          'Detached owner process stopped, but the isolation container could not be confirmed stopped. ' +\n            `Run state was not changed. ${(error as Error).message}`\n        );\n      }","sourceCodeStart":4394,"sourceCodeEnd":4430,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L4394-L4430","documentation":"After finding the run's `isolation_env_id`, the CLI looks it up in the isolation registry and requires it to be an actual `provider === 'container'` environment. If the registry record is absent or a different provider type, it refuses to cancel the run unchanged so the operator can inspect managed containers first.","triggerScenarios":"Cancelling a container-isolated run whose `isolation_env_id` points to a deleted registry entry or to a non-container environment type (e.g. a worktree env).","commonSituations":"Container registry rows garbage-collected while the run row still references them; run metadata pointing at the wrong environment ID; environment recreated under a new ID.","solutions":["List managed containers/environments in the isolation registry and match the run's container manually","Correct the run's `isolation_env_id` (scratch DB) if it points at the wrong record","Reclaim the container out-of-band, then proceed with the cancel once tracking is consistent"],"exampleFix":"// before\nawait cancelWorkflow(runId); // throws: env not a container\n// after\nconst env = await isolationDb.getById(run.metadata.isolation_env_id);\nif (env?.provider !== 'container') console.error('tracked env is not a container; inspect managed containers');\nelse await cancelWorkflow(runId);","handlingStrategy":"validation","validationCode":"const env = await isolationDb.getById(run.metadata.isolation_env_id);\nif (env?.provider !== 'container') {\n  throw new Error(`tracked env ${run.metadata.isolation_env_id} is not a container (${env?.provider ?? 'missing'})`);\n}","typeGuard":"const isContainerEnv = (e: { provider?: string } | null | undefined): e is { provider: 'container' } =>\n  e?.provider === 'container';","tryCatchPattern":null,"preventionTips":["Keep the isolation registry and run metadata in a consistent state; avoid out-of-band deletions","List managed containers before cancelling container-isolated runs","Reconcile stale registry references via a scratch DB before cancel"],"tags":["cli","workflow","cancel","container","registry-mismatch"],"backgroundTag":"container-registry-mismatch","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}