{"record":{"id":"3e88a64a7c70aad0","repo":"atuinsh/atuin","slug":"eof-in-the-middle-of-a-frame","errorCode":null,"errorMessage":"eof in the middle of a frame","messagePattern":"eof in the middle of a frame","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/atuin-pty-proxy/src/protocol.rs","lineNumber":166,"sourceCode":"    if len > MAX_FRAME_LEN {\n        return Err(io::Error::new(io::ErrorKind::InvalidData, \"frame exceeds maximum length\"));\n    }\n    let mut payload = vec![0u8; len];\n    reader.read_exact(&mut payload)?;\n    Ok(Some((frame_type, payload)))\n}\n\n/// Fill `buf` completely. Returns `Ok(false)` on EOF before the first byte,\n/// `Ok(true)` when full; EOF partway through is an [`io::ErrorKind::UnexpectedEof`].\nfn read_exact_or_eof(reader: &mut impl Read, buf: &mut [u8]) -> io::Result<bool> {\n    let mut filled = 0;\n    while filled < buf.len() {\n        match reader.read(&mut buf[filled..]) {\n            Ok(0) => {\n                if filled == 0 {\n                    return Ok(false);\n                }\n                return Err(io::Error::new(\n                    io::ErrorKind::UnexpectedEof,\n                    \"eof in the middle of a frame\",\n                ));\n            }\n            Ok(n) => filled += n,\n            Err(e) if e.kind() == io::ErrorKind::Interrupted => {}\n            Err(e) => return Err(e),\n        }\n    }\n    Ok(true)\n}\n\n/// Build a complete Subscribe frame.\n///\n/// # Panics\n///\n/// Panics if `token` is longer than `u16::MAX` bytes; real tokens are 64\n/// ASCII characters.","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/atuinsh/atuin/blob/15fe1318f1df51de604262eb50734c9883d48e7b/crates/atuin-pty-proxy/src/protocol.rs#L148-L184","documentation":"Error \"eof in the middle of a frame\" thrown in atuinsh/atuin.","triggerScenarios":"Fires when the pty-proxy stream ends partway through a frame, indicating a truncated message or dropped peer.","commonSituations":"See trigger scenarios.","solutions":["The connection closed mid-frame; retry and check for a crashing peer."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"15fe1318f1df51de604262eb50734c9883d48e7b","analyzedAt":"2026-08-19T08:56:57.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}