coleam00/Archon · error
Refusing to terminate invalid detached owner PID ${String(pi
Error message
Refusing to terminate invalid detached owner PID ${String(pid)} What it means
Error "Refusing to terminate invalid detached owner PID ${String(pid)}" thrown in coleam00/Archon.
Source
Thrown at packages/cli/src/utils/detached-run-control.ts:506
* carries neither. Nothing here reads message text, so it holds under any locale.
*
* Exported for testing: the Windows termination path tolerates a completed-but-failed
* command and must never tolerate an interrupted one, and that decision cannot be
* exercised from a platform where the path does not run.
*/
export function commandTerminatedBySignal(error: unknown): boolean {
if (typeof error !== 'object' || error === null) return false;
const { killed, signal } = error as { killed?: unknown; signal?: unknown };
return killed === true || typeof signal === 'string';
}
/** Terminate the process tree while its exact-run owner holds the IPC lease open. */
async function terminateDetachedProcessTree(
pid: number,
ownsLiveLease: () => boolean
): Promise<void> {
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid) {
throw new Error(`Refusing to terminate invalid detached owner PID ${String(pid)}`);
}
if (!ownsLiveLease()) {
throw new Error(`Detached workflow owner ${String(pid)} released its termination lease`);
}
if (process.platform === 'win32') {
// `taskkill /T` walks the tree PID by PID and exits non-zero when any of them is
// already gone — the outcome this function wants, reached early. Nothing in that
// exit code separates it from a kill that genuinely failed, so it is not the
// proof: the confirmation below is, the same way the POSIX branch tolerates ESRCH
// and then re-checks. A tree that is still running throws there, carrying the
// command's own error as the evidence.
//
// A walk that never finished is a different case and is rethrown here. The root
// check can only stand in for the whole tree when every descendant was visited,
// and a `timeout` kill leaves taskkill part-way through: the root can be gone
// while a descendant the walk never reached is still alive. `/T` is what takes
// the descendants with the root, and that they actually die is proved by theView on GitHub (pinned to 0773b97458)
When it happens
Trigger: Thrown at packages/cli/src/utils/detached-run-control.ts:506 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01).
Data as JSON: /api/errors/2380765a99cd976a.
Report an issue: GitHub.