can1357/oh-my-pi · error
missing supervised command
Error message
missing supervised command
What it means
Inside the generated Linux subreaper worker script, the supervised command is passed via the OMP_PTREE_SUBREAPER_COMMAND environment variable as JSON. This error is thrown when that variable is unset or empty at worker startup, meaning the worker was started without a command to supervise.
Source
Thrown at packages/utils/src/ptree.ts:54
args: [FFIType.i32, FFIType.u64, FFIType.u64, FFIType.u64, FFIType.u64],
returns: FFIType.i32,
},
waitpid: {
args: [FFIType.i32, FFIType.ptr, FFIType.i32],
returns: FFIType.i32,
},
});
break;
} catch {}
}
if (!libc) throw new Error("failed to load libc for Linux child supervision");
if (libc.symbols.prctl(36, 1, 0, 0, 0) !== 0) {
throw new Error("failed to become a Linux child subreaper");
}
const commandJson = Bun.env.${LINUX_SUBREAPER_COMMAND_ENV};
if (!commandJson) throw new Error("missing supervised command");
const callerBunBeBun = Bun.env.${LINUX_SUBREAPER_BUN_BE_BUN_ENV};
delete Bun.env.${LINUX_SUBREAPER_COMMAND_ENV};
delete Bun.env.${LINUX_SUBREAPER_BUN_BE_BUN_ENV};
if (callerBunBeBun === undefined) delete Bun.env.BUN_BE_BUN;
else Bun.env.BUN_BE_BUN = callerBunBeBun;
const command = JSON.parse(commandJson);
const child = Bun.spawn(command, {
stdin: "inherit",
stdout: "pipe",
stderr: "pipe",
windowsHide: true,
env: Bun.env,
});
async function relay(stream, destination) {
const writer = destination.writer();
for await (const chunk of stream) writer.write(chunk);
await writer.flush();View on GitHub (pinned to 9690622007)
Solutions
- Ensure the worker is spawned by ptree itself, which sets OMP_PTREE_SUBREAPER_COMMAND; don't launch the generated script manually.
- Check env-var sanitization layers (systemd, CI, wrappers) and whitelist the OMP_PTREE_SUBREAPER_* variables.
- If reproducing manually, export OMP_PTREE_SUBREAPER_COMMAND to a JSON array like '["echo","hi"]'.
Example fix
// before (manual run, no env) bun worker.ts // after OMP_PTREE_SUBREAPER_COMMAND='["sleep","10"]' bun worker.ts
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.OMP_PTREE_SUBREAPER_COMMAND) {
throw new Error('OMP_PTREE_SUBREAPER_COMMAND must be set before launching the subreaper worker');
} Prevention
- Always spawn the subreaper worker through ptree's API, never manually.
- Whitelist OMP_PTREE_* variables in any env-sanitizing layer (systemd, CI).
- Log the child's env keys in debug mode when debugging worker startup.
When it happens
Trigger: The subreaper worker process is spawned but the OMP_PTREE_SUBREAPER_COMMAND env var was not set (or was cleared) before spawning — e.g. the worker script is executed manually, an env-sanitizing wrapper strips unknown OMP_* variables, or the parent's env passing is broken.
Common situations: Manually re-running the worker script for debugging, environments that whitelist env vars (CI, systemd with EnvironmentFile sanitization), or tools that scrub 'unrecognized' variables from child environments.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- failed to load libc for Linux child supervision
- path contains NUL
- Azure OpenAI base URL is required. Set AZURE_OPENAI_BASE_URL
- container
- Invalid GITLAB_REDIRECT_URI: ${raw}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/d5ff59faaf3e86c9.
Report an issue: GitHub.