{"record":{"id":"57b724cff72c20ad","repo":"openai/codex","slug":"received-a-second-code-mode-client-hello","errorCode":null,"errorMessage":"received a second code-mode client hello","messagePattern":"received a second code-mode client hello","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/code-mode-host/src/lib.rs","lineNumber":220,"sourceCode":"                message = async {\n                    match &mut bulk_reader {\n                        Some(reader) => reader.read().await,\n                        None => Ok(None),\n                    }\n                }, if bulk_reader.is_some() => (\n                    message.context(\"failed to read code-mode client bulk message\")?,\n                    TransportLane::Bulk,\n                ),\n            };\n            let Some(message) = message else {\n                break;\n            };\n            if bulk_reader.is_some() && !message.allows_transport_lane(lane) {\n                anyhow::bail!(\"code-mode client sent a message on the wrong websocket lane\");\n            }\n            match message {\n                ClientToHost::ClientHello(_) => {\n                    anyhow::bail!(\"received a second code-mode client hello\");\n                }\n                ClientToHost::Request { id, request } => {\n                    state.spawn_request(id, request)?;\n                }\n                ClientToHost::CancelRequest { id } => {\n                    state.cancel_request(id);\n                }\n                ClientToHost::DelegateResponse { id, result } => {\n                    peer.complete(id, result.into_result()).await;\n                }\n            }\n        }\n        Ok::<(), anyhow::Error>(())\n    }\n    .await;\n\n    peer.disconnect();\n    if tokio::time::timeout(SHUTDOWN_TIMEOUT, state.disconnect())","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/code-mode-host/src/lib.rs#L202-L238","documentation":"Bailed during negotiate when a second client hello frame arrives after the handshake already completed. The protocol expects exactly one hello per lane; a duplicate indicates a misbehaving client and the negotiation is aborted.","triggerScenarios":"Thrown at codex-rs/code-mode-host/src/lib.rs:220 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Update the code-mode client — it is re-sending hello","Check for a client bug that restarts the handshake mid-connection"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}