{"record":{"id":"1b0a5f5825395e12","repo":"musistudio/claude-code-router","slug":"profile-profile-agent-zcode-zcode-1b0a5f","errorCode":null,"errorMessage":"[profile] ${profile.agent === \"zcode\" ? \"ZCode\" : \"Codex\"} App bot worker failed: ${formatError(error)}","messagePattern":"\\[profile\\] (.+?) App bot worker failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/core/src/profiles/launch-service.ts","lineNumber":1489,"sourceCode":"    detached: false,\n    env,\n    stdio: [\"ignore\", \"ignore\", \"pipe\"],\n    windowsHide: true,\n    windowsVerbatimArguments: launch.windowsVerbatimArguments\n  });\n  codexAppBotWorkers.set(profile.id, { agent: profile.agent, child, stateDir: botEnv.CCR_BOT_GATEWAY_STATE_DIR });\n  child.stderr?.on(\"data\", (chunk) => {\n    console.warn(`[profile] ${profile.agent === \"zcode\" ? \"ZCode\" : \"Codex\"} App bot worker stderr: ${chunk.toString(\"utf8\").trim()}`);\n  });\n  child.once(\"exit\", (code, signal) => {\n    if (codexAppBotWorkers.get(profile.id)?.child === child) codexAppBotWorkers.delete(profile.id);\n    if (code && code !== 0) {\n      console.warn(`[profile] ${profile.agent === \"zcode\" ? \"ZCode\" : \"Codex\"} App bot worker exited: code=${code}${signal ? ` signal=${signal}` : \"\"}`);\n    }\n  });\n  child.once(\"error\", (error) => {\n    if (codexAppBotWorkers.get(profile.id)?.child === child) codexAppBotWorkers.delete(profile.id);\n    console.warn(`[profile] ${profile.agent === \"zcode\" ? \"ZCode\" : \"Codex\"} App bot worker failed: ${formatError(error)}`);\n  });\n}\n\nfunction startCodexAppMediaPreviewBridge(\n  config: AppConfig,\n  profile: ReturnType<typeof findProfileForOpen>,\n  userDataDir: string\n): void {\n  if (profile.agent !== \"codex\" || !shouldEnableCodexMediaPreviewBridge(config.mediaTools.enabled)) {\n    stopCodexAppMediaPreviewBridge(profile.id);\n    return;\n  }\n  const bridge = new CodexAppMediaPreviewBridge({\n    endpoint: mediaToolsGatewayEndpoint(config),\n    profileId: profile.id,\n    userDataDir\n  });\n  const existing = codexAppMediaPreviewBridges.get(profile.id);","sourceCodeStart":1471,"sourceCodeEnd":1507,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/profiles/launch-service.ts#L1471-L1507","documentation":"Emitted on the 'error' event of a Codex/ZCode App bot worker child process: the process failed to spawn or errored at the OS level. The per-profile entry is removed from codexAppBotWorkers and the warning logged; other profiles' workers are unaffected.","triggerScenarios":"Spawning the Codex/zcode bot worker for a profile fails — binary missing (ENOENT), not executable, or killed by the OS — triggering child.once('error').","commonSituations":"Codex CLI not installed for that profile; multi-profile setups where one profile's agent binary is absent while others work; Windows launcher issues with windowsVerbatimArguments paths.","solutions":["Verify the Codex/ZCode executable for the failing profile exists and runs manually.","Reinstall the agent CLI for that profile or fix its configured path.","On Windows, quote/check the launcher path that uses verbatim arguments.","Restart the gateway after fixing so the worker respawns."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Install per-profile agent binaries before enabling bot workers","Quote Windows launcher paths correctly","Restart the gateway after repairing the binary"],"tags":["child-process","spawn","bot-worker","codex"],"backgroundTag":"child-process-spawn-failed","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}