{"record":{"id":"95b5a0de0719e93a","repo":"n0-computer/iroh","slug":"frametoolarge","errorCode":"FrameTooLarge","errorMessage":"Frame is too large, has {frame_len} bytes","messagePattern":"Frame is too large, has (.+?) bytes","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"iroh-relay/src/protos/relay.rs","lineNumber":403,"sourceCode":"            Self::Health { problem } => problem.len(),\n        };\n        self.typ().encoded_len() + payload_len\n    }\n\n    /// Tries to decode a frame received over websockets.\n    ///\n    /// Specifically, bytes received from a binary websocket message frame.\n    ///\n    /// `protocol_version` is the negotiated protocol version for this connection.\n    #[allow(clippy::result_large_err)]\n    pub(crate) fn from_bytes(\n        mut content: Bytes,\n        cache: &KeyCache,\n        protocol_version: ProtocolVersion,\n    ) -> Result<Self, Error> {\n        let frame_type = FrameType::from_bytes(&mut content)?;\n        let frame_len = content.len();\n        ensure!(\n            frame_len <= MAX_PACKET_SIZE,\n            Error::FrameTooLarge { frame_len }\n        );\n\n        let res = match frame_type {\n            FrameType::RelayToClientDatagram | FrameType::RelayToClientDatagramBatch => {\n                ensure!(content.len() >= EndpointId::LENGTH, Error::InvalidFrame);\n\n                let remote_endpoint_id = cache.key_from_slice(&content[..EndpointId::LENGTH])?;\n                let datagrams = Datagrams::from_bytes(\n                    content.slice(EndpointId::LENGTH..),\n                    frame_type == FrameType::RelayToClientDatagramBatch,\n                )?;\n                Self::Datagrams {\n                    remote_endpoint_id,\n                    datagrams,\n                }\n            }","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/n0-computer/iroh/blob/2b4de030ce5e0133f272871a76f0c685c63f552a/iroh-relay/src/protos/relay.rs#L385-L421","documentation":"Error::FrameTooLarge is returned when decoding an inbound relay frame whose content length (frame_len) exceeds MAX_PACKET_SIZE. The relay protocol caps packet size, so any larger frame is rejected at decode time rather than processed. This indicates a malicious, buggy, or non-protocol peer.","triggerScenarios":"Receiving a frame from a relay whose payload after the frame-type byte is longer than MAX_PACKET_SIZE and passing it to from_bytes.","commonSituations":"Connecting to a hostile or non-iroh server that sends oversized payloads; desynchronized framing that misreads lengths and treats multiple frames as one giant frame.","solutions":["Verify you are connected to a genuine, up-to-date iroh relay server.","Check the framing layer: a misparsed length prefix can merge frames — confirm lengths are read with the right endianness/width.","Drop the connection on this error; oversized frames indicate desync that cannot be recovered in-stream."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"fn plausible_frame(content: &Bytes) -> bool {\n    !content.is_empty() && content.len() - 1 <= MAX_PACKET_SIZE\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch Frame::from_bytes(content, false) {\n    Err(Error::FrameTooLarge { frame_len }) => {\n        tracing::error!(frame_len, \"oversized frame from relay — closing connection\");\n        conn.close(); // framing is untrusted; cannot recover in-stream\n    }\n    other => other?,\n}","preventionTips":["Connect only to trusted, up-to-date iroh relays.","Validate frame length prefixes with correct endianness to avoid merged frames.","Close the connection on any size-limit violation rather than attempting resync."],"tags":["network","protocol","security","decoding","iroh"],"backgroundTag":"payload-too-large","analyzedSha":"2b4de030ce5e0133f272871a76f0c685c63f552a","analyzedAt":"2026-09-08T04:26:47.755Z","contentChangedAt":"2026-09-08T04:26:47.755Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}