{"record":{"id":"9bceb2c42cf2dd1f","repo":"apache/shenyu","slug":"unable-to-merge-from-the-supplied-input-stream-jsonmessage","errorCode":null,"errorMessage":"Unable to merge from the supplied input stream","messagePattern":"Unable to merge from the supplied input stream","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"shenyu-protocol/shenyu-protocol-grpc/src/main/java/org/apache/shenyu/protocol/grpc/message/JsonMessage.java","lineNumber":220,"sourceCode":"    /**\n     * DynamicMessageMarshaller.\n     */\n    private static final class DynamicMessageMarshaller implements MethodDescriptor.Marshaller<DynamicMessage> {\n\n        private final Descriptors.Descriptor messageDescriptor;\n\n        private DynamicMessageMarshaller(final Descriptors.Descriptor messageDescriptor) {\n            this.messageDescriptor = messageDescriptor;\n        }\n\n        @Override\n        public DynamicMessage parse(final InputStream inputStream) {\n            try {\n                return DynamicMessage.newBuilder(messageDescriptor)\n                        .mergeFrom(inputStream, ExtensionRegistryLite.getEmptyRegistry())\n                        .build();\n            } catch (IOException e) {\n                throw new RuntimeException(\"Unable to merge from the supplied input stream\", e);\n            }\n        }\n\n        @Override\n        public InputStream stream(final DynamicMessage abstractMessage) {\n            return abstractMessage.toByteString().newInput();\n        }\n    }\n}\n","sourceCodeStart":202,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-protocol/shenyu-protocol-grpc/src/main/java/org/apache/shenyu/protocol/grpc/message/JsonMessage.java#L202-L230","documentation":"This is the Protobuf marshaller's parse method used when the gateway decodes a gRPC message payload into a DynamicMessage. mergeFrom(inputStream) throws IOException if the underlying stream fails while reading bytes; the marshaller wraps that in a RuntimeException with this fixed message. It signals a corrupted or broken input stream, not a schema mismatch (which would be an InvalidProtocolBufferException path).","triggerScenarios":"gRPC response/request body streaming is interrupted or the InputStream supplied to parse() cannot be fully read (connection reset mid-body, truncated frame) while DynamicMessage.newBuilder(messageDescriptor).mergeFrom(...) runs.","commonSituations":"Unstable network between gateway and gRPC backend; backend closing the connection before the full message is sent; proxies/timeouts truncating gRPC frames; upstream servers under load dropping streams.","solutions":["Retry the gRPC call; transient stream truncation usually resolves with a fresh request.","Check connectivity and stability to the backend gRPC service (timeouts, LB health checks, proxy idle limits).","Inspect the backend service logs for early connection close or panics while streaming the response.","If a proxy sits between gateway and backend, raise its idle/stream timeouts and ensure it supports gRPC (HTTP/2) without buffering limits that cut frames."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    return marshaller.parse(inputStream);\n} catch (RuntimeException e) {\n    if (\"Unable to merge from the supplied input stream\".equals(e.getMessage())\n            && e.getCause() instanceof IOException) {\n        // retry the upstream gRPC call on a fresh stream\n    }\n    throw e;\n}","preventionTips":["Set sane timeouts and retries on upstream gRPC channels.","Ensure intermediaries support HTTP/2 and don't truncate streams.","Monitor backend health to catch early connection closes."],"tags":["grpc","protobuf","io","stream"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}