{"record":{"id":"3f8abaaabd90e9fe","repo":"apache/flink","slug":"please-invoke-deserializationschema-deserialize-by-3f8aba","errorCode":null,"errorMessage":"Please invoke DeserializationSchema#deserialize(byte[], Collector<RowData>) instead.","messagePattern":"Please invoke DeserializationSchema#deserialize\\(byte\\[\\], Collector<RowData>\\) instead\\.","errorType":"exception","errorClass":"FlinkRuntimeException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/AbstractJsonDeserializationSchema.java","lineNumber":125,"sourceCode":"        if (hasDecimalType) {\n            objectMapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);\n        }\n        reusableCollectList = new ArrayList<>();\n        collector = new ListCollector<>(reusableCollectList);\n    }\n\n    /**\n     * @deprecated Use {@link DeserializationSchema#deserialize(byte[], Collector)} instead. The\n     *     implementation of {@link AbstractJsonDeserializationSchema#deserialize(byte[])} will be\n     *     removed in <a href=\"https://issues.apache.org/jira/browse/FLINK-37707\">FLINK-37707</a>.\n     */\n    @Deprecated\n    @Override\n    public RowData deserialize(@Nullable byte[] message) throws IOException {\n        reusableCollectList.clear();\n        deserialize(message, collector);\n        if (reusableCollectList.size() > 1) {\n            throw new FlinkRuntimeException(\n                    \"Please invoke \"\n                            + \"DeserializationSchema#deserialize(byte[], Collector<RowData>) instead.\");\n        }\n        if (reusableCollectList.isEmpty()) {\n            return null;\n        }\n        return reusableCollectList.get(0);\n    }\n\n    @Override\n    public boolean isEndOfStream(RowData nextElement) {\n        return false;\n    }\n\n    @Override\n    public TypeInformation<RowData> getProducedType() {\n        return resultTypeInfo;\n    }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/AbstractJsonDeserializationSchema.java#L107-L143","documentation":"FlinkRuntimeException thrown by the deprecated single-row deserialize(byte[]) path of AbstractJsonDeserializationSchema when a single input message produced more than one RowData. The parser-based JSON deserializer can emit multiple rows per message (e.g., a JSON array '[{...},{...}]' is exploded into one row per element), which cannot be returned from the single-value method, so it fails and tells you to use the Collector variant.","triggerScenarios":"Calling DeserializationSchema.deserialize(byte[]) on JsonParserRowDataDeserializationSchema when the message is a JSON array with 2+ elements, or any input where the collector receives multiple collect() calls; typical when reusing the schema inside a custom SourceFunction or MapFunction instead of a standard connector runtime.","commonSituations":"Legacy custom sources that call the deprecated method; Kafka connector is fine (it uses the Collector overload); consuming newline-concatenated or array-form JSON payloads with the parser schema.","solutions":["Switch to deserialize(byte[] message, Collector<RowData> out) which handles multi-row messages","Or wrap the schema in a DeserializationSchema-based caller that always uses the Collector form (as the Kafka/FileSystem connectors do)","If you truly need one-row-per-call semantics, feed single JSON objects rather than arrays"],"exampleFix":"// before\nRowData row = schema.deserialize(messageBytes);\n\n// after\nschema.deserialize(messageBytes, new Collector<RowData>() {\n    @Override public void collect(RowData r) { downstream.accept(r); }\n    @Override public void close() {}\n});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    RowData row = schema.deserialize(bytes);\n} catch (FlinkRuntimeException e) {\n    if (e.getMessage().contains(\"Collector\")) {\n        // switch caller to deserialize(bytes, collector)\n    }\n}","preventionTips":["Always call the Collector overload in custom sources/functions","Never assume one byte[] equals one row for JSON: arrays may explode into many"],"tags":["flink","json","deserialization","deprecated-api","array"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}