{"record":{"id":"e7afb586a48b6e32","repo":"coleam00/Archon","slug":"internal-detached-run-id-is-set-by-a-detached-la","errorCode":null,"errorMessage":"--internal-detached-run-id is set by a detached launch for its own child. Use `archon workflow run <name> --detach`.","messagePattern":"--internal-detached-run-id is set by a detached launch for its own child\\. Use `archon workflow run <name> --detach`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":1487,"sourceCode":"  // Be precise about which one carries the weight, because it is not the first.\n  //\n  // The owner marker plus `assertDetachedRunProcessOwner` (above) raise the bar, they do\n  // not prove provenance: a plain scripted process is not its own process-group leader,\n  // so cron, CI, and wrapper scripts are blocked — but a foreground command under a real\n  // pseudo-tty IS one by default, so a person setting the env var at their own terminal\n  // satisfies it. Treat it as a barrier to automated misuse, not as proof that an Archon\n  // parent launched this process.\n  //\n  // The catastrophic outcomes are closed by the other two, which hold no matter how the\n  // first is satisfied. `status === 'pending'` is what stops a stale or mistyped id from\n  // loading a TERMINAL row, whose DAG the executor would re-run, appending events onto\n  // closed evidence. The `workflow_name` match (checked once the workflow resolves,\n  // below) is what stops one launch's row being executed as another workflow. Neither is\n  // redundant with the process-group check, and removing either reopens its own outcome.\n  let detachedPreCreatedRun: WorkflowRun | undefined;\n  if (options.detachedRunId !== undefined) {\n    if (!detachedProcessOwner) {\n      throw new Error(\n        '--internal-detached-run-id is set by a detached launch for its own child. ' +\n          'Use `archon workflow run <name> --detach`.'\n      );\n    }\n    detachedPreCreatedRun = (await workflowDb.getWorkflowRun(options.detachedRunId)) ?? undefined;\n    if (!detachedPreCreatedRun) {\n      throw new Error(\n        `Detached workflow child cannot find the run '${options.detachedRunId}' its launcher created.`\n      );\n    }\n    if (detachedPreCreatedRun.status !== 'pending') {\n      throw new Error(\n        `Cannot execute run '${detachedPreCreatedRun.id}': it is ${detachedPreCreatedRun.status}, ` +\n          'not a run awaiting its first execution. Resume it with `archon workflow resume` instead.'\n      );\n    }\n  }\n","sourceCodeStart":1469,"sourceCodeEnd":1505,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L1469-L1505","documentation":"Error \"--internal-detached-run-id is set by a detached launch for its own child. Use `archon workflow run <name> --detach`.\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/cli/src/commands/workflow.ts:1487 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}