musistudio/claude-code-router · warning

[profile] OpenCode App bot worker failed: ${formatError(erro

Error message

[profile] OpenCode App bot worker failed: ${formatError(error)}

What it means

Emitted on the 'error' event of the OpenCode App bot worker child process: spawn failure (missing binary), kill, or IPC failure. The module-level singletons (openCodeAppBotWorker, profile id, signature, state dir) are reset, so the next launch signature can restart it.

Source

Thrown at packages/core/src/profiles/launch-service.ts:1444

  child.once("exit", (code, signal) => {
    if (openCodeAppBotWorker === child) {
      openCodeAppBotWorker = undefined;
      openCodeAppBotWorkerProfileId = undefined;
      openCodeAppBotWorkerSignature = undefined;
      openCodeAppBotWorkerStateDir = undefined;
    }
    if (code && code !== 0) {
      console.warn(`[profile] OpenCode App bot worker exited: code=${code}${signal ? ` signal=${signal}` : ""}`);
    }
  });
  child.once("error", (error) => {
    if (openCodeAppBotWorker === child) {
      openCodeAppBotWorker = undefined;
      openCodeAppBotWorkerProfileId = undefined;
      openCodeAppBotWorkerSignature = undefined;
      openCodeAppBotWorkerStateDir = undefined;
    }
    console.warn(`[profile] OpenCode App bot worker failed: ${formatError(error)}`);
  });
}

function startCodexAppBotWorker(config: AppConfig, profile: ReturnType<typeof findProfileForOpen>): void {
  const botEnv = botGatewayProfileEnv(config, profile, "app");
  if (botEnv.CCR_BOT_GATEWAY_ENABLED !== "true") {
    stopCodexAppBotWorker(profile.id);
    return;
  }
  const existing = codexAppBotWorkers.get(profile.id);
  if (existing && !existing.child.killed && existing.child.exitCode === null) {
    return;
  }
  stopCodexAppBotWorker(profile.id);
  const plan = buildProfileLaunchPlan(CONFIGDIR, profile, "app", ["codex-bot-worker", "--workspace-name", profile.name || profile.id]);
  const launch = profileLaunchSpawnCommand(plan);
  const env: NodeJS.ProcessEnv = {
    ...process.env,

View on GitHub (pinned to 99f24806c6)

Solutions

  1. Confirm the OpenCode binary/app exists and runs from the gateway's environment.
  2. Reinstall or re-link the OpenCode app so the launcher path in the profile resolves.
  3. Clear stale worker state if the launch signature changed after an upgrade (it auto-restarts on next launch).
  4. Check OS-level restrictions (permissions, containers) on spawning children.
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Spawning the OpenCode bot worker fails — executable not found (ENOENT), not executable (EACCES), or the process dies with an error event before normal exit.

Common situations: OpenCode CLI not installed or not on PATH for the gateway user; stale launchSignature after an app update moves binaries; sandboxed environments blocking process spawn.

Related errors


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/cc6ac3a5cfc83258. Report an issue: GitHub.