{"record":{"id":"207e86e47718ebaa","repo":"musistudio/claude-code-router","slug":"profile-profile-agent-zcode-zcode","errorCode":null,"errorMessage":"[profile] ${profile.agent === \"zcode\" ? \"ZCode\" : \"Codex\"} App bot worker stderr: ${chunk.toString(\"utf8\").trim()}","messagePattern":"\\[profile\\] (.+?) App bot worker stderr: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/core/src/profiles/launch-service.ts","lineNumber":1479,"sourceCode":"  const env: NodeJS.ProcessEnv = {\n    ...process.env,\n    ...plan.env,\n    ...botEnv,\n    CCR_CODEX_BOT_WORKER: \"1\",\n    CCR_PROFILE_SURFACE: \"app\",\n    CODEXL_PROFILE_SURFACE: \"app\"\n  };\n  delete env.ELECTRON_NO_ATTACH_CONSOLE;\n  const child = spawn(launch.command, launch.args, {\n    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 {","sourceCodeStart":1461,"sourceCodeEnd":1497,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/profiles/launch-service.ts#L1461-L1497","documentation":"Raw stderr passthrough from the Codex/ZCode App bot worker child (tracked per profile.id in codexAppBotWorkers). Anything the worker writes to stderr is logged with an agent-specific label; lifecycle is managed by separate exit/error handlers that also clean the per-profile map entry.","triggerScenarios":"A Codex or ZCode profile's bot worker writes to stderr — internal diagnostics, caught-error stack traces, or dependency warnings.","commonSituations":"Codex CLI emitting warnings during startup or on API errors; zcode variant printing different diagnostics; benign deprecation output.","solutions":["Read the stderr text to classify it (noise vs pre-crash stack).","Check the worker's exit code warnings (the sibling 'exited: code=...' message) to see if it actually crashed.","Inspect the per-profile state dir (CCR_BOT_GATEWAY_STATE_DIR) logs for the root cause.","Update the Codex/zcode app if the output is a known issue."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"null","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Use the agent label to route diagnostics to the right tool","Check sibling exit-code warnings for real crashes","Inspect per-profile state dir logs"],"tags":["child-process","stderr","bot-worker","codex"],"backgroundTag":"child-process-stderr","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}