{"record":{"id":"a1586f2c764b570d","repo":"apache/flink","slug":"no-more-bytes-left","errorCode":null,"errorMessage":"No more bytes left.","messagePattern":"No more bytes left\\.","errorType":"exception","errorClass":"KryoException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NoFetchingInput.java","lineNumber":151,"sourceCode":"    @Override\n    public void readBytes(byte[] bytes, int offset, int count) throws KryoException {\n        if (bytes == null) {\n            throw new IllegalArgumentException(\"bytes cannot be null.\");\n        }\n\n        if (count == 0) {\n            return;\n        }\n\n        try {\n            int bytesRead = 0;\n            int c;\n\n            while (true) {\n                c = inputStream.read(bytes, offset + bytesRead, count - bytesRead);\n\n                if (c == -1) {\n                    throw new KryoException(new EOFException(\"No more bytes left.\"));\n                }\n\n                bytesRead += c;\n\n                if (bytesRead == count) {\n                    break;\n                }\n            }\n        } catch (IOException ex) {\n            throw new KryoException(ex);\n        }\n    }\n}\n","sourceCodeStart":133,"sourceCodeEnd":165,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NoFetchingInput.java#L133-L165","documentation":"KryoException wrapping EOFException, thrown by NoFetchingInput.readBytes when the underlying stream returns -1 before 'count' bytes have been read. It signals a truncated payload: the reader expected more bytes than the stream contains.","triggerScenarios":"Bulk readBytes(bytes, offset, count) where the serialized data ends early - e.g. a byte[]/String field whose stored length exceeds the remaining stream, or a cut-off stream mid-field.","commonSituations":"Corrupted or truncated checkpoints/savepoints; a length field written incorrectly (stale length after a field was resized); deserializing with a mismatched schema that reads a longer array length than was written.","solutions":["Confirm serializer schema symmetry: the reader must read field lengths exactly as the writer wrote them","Validate the stream/framing integrity before deserialization (lengths, checksums)","If this occurs on state restore, test restore against the exact checkpoint that produced the data and check for partial uploads"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    input.readBytes(buf, 0, len);\n} catch (KryoException e) {\n    if (e.getCause() instanceof EOFException) {\n        throw new IOException(\"Truncated payload: expected \" + len + \" bytes\", e);\n    }\n    throw e;\n}","preventionTips":["Validate stored lengths before bulk reads","Write length fields from the actual data size, never cached values","Round-trip test serialize/deserialize for every schema variant"],"tags":["kryo","serialization","eof","truncated-data"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}