{"record":{"id":"828f708b44b54956","repo":"openai/codex","slug":"interrupted-828f70","errorCode":"Interrupted","errorMessage":"Login cancelled","messagePattern":"Login cancelled","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/login/src/server.rs","lineNumber":523,"sourceCode":"            } else {\n                include_str!(\"assets/success_legacy.html\")\n            };\n            HandledRequest::ResponseAndExit {\n                headers: match Header::from_bytes(\n                    &b\"Content-Type\"[..],\n                    &b\"text/html; charset=utf-8\"[..],\n                ) {\n                    Ok(header) => vec![header],\n                    Err(_) => Vec::new(),\n                },\n                body: body.as_bytes().to_vec(),\n                result: Ok(()),\n            }\n        }\n        \"/cancel\" => HandledRequest::ResponseAndExit {\n            headers: Vec::new(),\n            body: b\"Login cancelled\".to_vec(),\n            result: Err(io::Error::new(\n                io::ErrorKind::Interrupted,\n                \"Login cancelled\",\n            )),\n        },\n        _ => HandledRequest::Response(Response::from_string(\"Not Found\").with_status_code(404)),\n    }\n}\n\n/// tiny_http filters `Connection` headers out of `Response` objects, so using\n/// `req.respond` never informs the client (or the library) that a keep-alive\n/// socket should be closed. That leaves the per-connection worker parked in a\n/// loop waiting for more requests, which in turn causes the next login attempt\n/// to hang on the old connection. This helper bypasses tiny_http’s response\n/// machinery: it extracts the raw writer, prints the HTTP response manually,\n/// and always appends `Connection: close`, ensuring the socket is closed from\n/// the server side. Ideally, tiny_http would provide an API to control\n/// server-side connection persistence, but it does not.\nfn send_response_with_disconnect(","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/login/src/server.rs#L505-L541","documentation":"Error \"Login cancelled\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/login/src/server.rs:523 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}