{"record":{"id":"3d1a964d3a36f529","repo":"apache/flink","slug":"postversionedioreadablewritable-cannot-read-from-a","errorCode":null,"errorMessage":"PostVersionedIOReadableWritable cannot read from a DataInputView.","messagePattern":"PostVersionedIOReadableWritable cannot read from a DataInputView\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/core/io/PostVersionedIOReadableWritable.java","lineNumber":90,"sourceCode":"        } else {\n            InputStream streamToRead = inputStream;\n            if (totalRead > 0) {\n                PushbackInputStream resetStream = new PushbackInputStream(inputStream, totalRead);\n                resetStream.unread(tmp, 0, totalRead);\n                streamToRead = resetStream;\n            }\n\n            read(new DataInputViewStreamWrapper(streamToRead), false);\n        }\n    }\n\n    /**\n     * We do not support reading from a {@link DataInputView}, because it does not support pushing\n     * back already read bytes.\n     */\n    @Override\n    public final void read(DataInputView in) throws IOException {\n        throw new UnsupportedOperationException(\n                \"PostVersionedIOReadableWritable cannot read from a DataInputView.\");\n    }\n}\n","sourceCodeStart":72,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/core/io/PostVersionedIOReadableWritable.java#L72-L94","documentation":"Thrown unconditionally by PostVersionedIOReadableWritable.read(DataInputView) — the method is marked final and always throws UnsupportedOperationException. PostVersionedIOReadableWritable must sniff the first bytes of a stream to detect whether data was previously versioned, and DataInputView does not support pushback, so reading from a DataInputView is structurally unsupported. Callers must use the read(InputStream) overload instead.","triggerScenarios":"Invoking the inherited IOReadableWritable.read(DataInputView) contract on a PostVersionedIOReadableWritable subclass (e.g. via a generic IOReadableWritable.read dispatch); frameworks that route deserialization through DataInputView rather than InputStream.","commonSituations":"Generic serialization frameworks that call read(DataInputView) polymorphically without checking the concrete type; migrating code that used VersionedIOReadableWritable (which supports DataInputView) to a PostVersionedIOReadableWritable subclass.","solutions":["Call read(InputStream) on PostVersionedIOReadableWritable instead of read(DataInputView).","Wrap your DataInputView source as an InputStream (or use the original InputStream) before calling read.","If you are inside a framework that only provides DataInputView, use a VersionedIOReadableWritable subclass instead, or buffer the data and re-expose it as a stream."],"exampleFix":"// before\nPostVersionedIOReadableWritable obj = ...;\nobj.read(dataInputView); // throws\n\n// after — pass an InputStream\nobj.read(inputStream);","handlingStrategy":"validation","validationCode":"if (obj instanceof PostVersionedIOReadableWritable) {\n    // must use read(InputStream), not read(DataInputView)\n    obj.read(inputStream);\n}","typeGuard":"obj instanceof PostVersionedIOReadableWritable","tryCatchPattern":null,"preventionTips":["Always call read(InputStream) on PostVersionedIOReadableWritable subclasses.","In generic frameworks, branch on PostVersionedIOReadableWritable before dispatching to read(DataInputView).","Preserve the original InputStream rather than converting to DataInputView prematurely."],"tags":["serialization","versioned-io","api-misuse","unsupported-operation"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}