{"record":{"id":"d11508f10f5be205","repo":"Textualize/textual","slug":"more-data-expected","errorCode":null,"errorMessage":"More data expected","messagePattern":"More data expected","errorType":"exception","errorClass":"DecodeError","httpStatus":null,"severity":"error","filePath":"src/textual/_binary_encode.py","lineNumber":197,"sourceCode":"        Decoded data.\n    \"\"\"\n    if not isinstance(encoded, bytes):\n        raise TypeError(\"must be bytes\")\n    max_position = len(encoded)\n    position = 0\n\n    def get_byte() -> bytes:\n        \"\"\"Get an encoded byte and advance position.\n\n        Raises:\n            DecodeError: If the end of the data was reached\n\n        Returns:\n            A bytes object with a single byte.\n        \"\"\"\n        nonlocal position\n        if position >= max_position:\n            raise DecodeError(\"More data expected\")\n        character = encoded[position : position + 1]\n        position += 1\n        return character\n\n    def peek_byte() -> bytes:\n        \"\"\"Get the byte at the current position, but don't advance position.\n\n        Returns:\n            A bytes object with a single byte.\n        \"\"\"\n        return encoded[position : position + 1]\n\n    def get_bytes(size: int) -> bytes:\n        \"\"\"Get a number of bytes of encode data.\n\n        Args:\n            size: Number of bytes to retrieve.\n","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/Textualize/textual/blob/06dbeef4bb70fb718236aa418ed658ef4667a126/src/textual/_binary_encode.py#L179-L215","documentation":"While decoding, get_byte() detects that the position pointer has reached the end of the buffer but the encoded structure says more bytes should follow, and raises DecodeError('More data expected'). It indicates a truncated or corrupt payload, not a caller type mistake.","triggerScenarios":"Passing truncated bytes to load(); a payload that was cut off mid-transmission over the devtools socket; hand-crafted byte sequences that don't match the encoding grammar.","commonSituations":"Partial reads from a socket/stream (reading fewer bytes than the message length), bugs in a proxy or relay that split/concatenate frames incorrectly, or corrupted cached binary data.","solutions":["Ensure the full message is received before decoding (read exact declared length from the socket)","Re-request or regenerate the payload instead of decoding partial data","If relaying devtools traffic, preserve frame boundaries and byte-for-byte content","Add a length prefix or use the protocol's framing when transporting encoded blobs"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from textual._binary_encode import DecodeError\ntry:\n    value = load(payload)\nexcept DecodeError:\n    value = None  # discard truncated frame, request resend","preventionTips":["Frame messages with a length prefix and read exactly that many bytes","Validate payload integrity (checksum) before decoding","Never decode partially-read socket buffers"],"tags":["python","textual","serialization","truncated-data","decode-error"],"backgroundTag":"truncated-payload-decode-error","analyzedSha":"06dbeef4bb70fb718236aa418ed658ef4667a126","analyzedAt":"2026-08-27T02:36:57.214Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}