{"record":{"id":"03ffb186522539c7","repo":"pinpoint-apm/pinpoint","slug":"unsupported-message-03ffb1","errorCode":null,"errorMessage":"unsupported message ","messagePattern":"unsupported message ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/SpanGrpcDataSender.java","lineNumber":87,"sourceCode":"            final GeneratedMessageV3 message = messageConverter.toMessage(data);\n            if (isDebug) {\n                logger.debug(\"Send message={}\", debugLog(message));\n            }\n            if (message instanceof PSpanChunk) {\n                final PSpanChunk spanChunk = (PSpanChunk) message;\n                final PSpanMessage spanMessage = PSpanMessage.newBuilder().setSpanChunk(spanChunk).build();\n                stream.onNext(spanMessage);\n                attemptRenew();\n                return;\n            }\n            if (message instanceof PSpan) {\n                final PSpan pSpan = (PSpan) message;\n                final PSpanMessage spanMessage = PSpanMessage.newBuilder().setSpan(pSpan).build();\n                stream.onNext(spanMessage);\n                attemptRenew();\n                return;\n            }\n            throw new IllegalStateException(\"unsupported message \" + data);\n        }\n    };\n\n\n    public SpanGrpcDataSender(String host, int port,\n                              int executorQueueSize,\n                              MessageConverter<SpanType, GeneratedMessageV3> messageConverter,\n                              ReconnectExecutor reconnectExecutor,\n                              ChannelFactory channelFactory,\n                              StreamState failState,\n                              long maxRpcAgeMillis) {\n        super(host, port, executorQueueSize, messageConverter, channelFactory);\n        this.spanStub = SpanGrpc.newStub(managedChannel);\n\n        this.interval = newIntervalFunction(maxRpcAgeMillis);\n        this.rpcExpiredAt = new AtomicLong(System.currentTimeMillis());\n\n        this.reconnectExecutor = Objects.requireNonNull(reconnectExecutor, \"reconnectExecutor\");","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/SpanGrpcDataSender.java#L69-L105","documentation":"SpanGrpcDataSender's onDispatch consumer converts queued MetricType data to protobuf and requires a PSpan-capable message; if the converted message is neither a supported span type it throws IllegalStateException \"unsupported message\". The stream only accepts span messages, so other types are a programming/routing error.","triggerScenarios":"Dispatching a data object through SpanGrpcDataSender whose messageConverter output is not the expected PSpan (or sibling span message) — e.g. sending a SpanChunk/agent URI stat to the span sender.","commonSituations":"Misconfigured sender wiring where span and stat senders are swapped, a custom MessageConverter returning an unexpected message type, or new telemetry types routed to the span stream without updating onDispatch.","solutions":["Send only span-type data (converting to PSpan/PSpanMessage) to SpanGrpcDataSender","Route stat/metric data to StatGrpcDataSender instead","Extend onDispatch to handle and convert the new message type if it belongs on the span stream"],"exampleFix":"// before\nspanSender.send(agentUriStat);\n// after\nstatSender.send(agentUriStat);","handlingStrategy":"type-guard","validationCode":"if (!(messageConverter.toMessage(data) instanceof PSpan)) { throw new IllegalStateException(\"SpanGrpcDataSender only accepts span data\"); }","typeGuard":"GeneratedMessageV3 msg = messageConverter.toMessage(data);\nif (msg instanceof PSpan pSpan) { stream.onNext(PSpanMessage.newBuilder().setSpan(pSpan).build()); }","tryCatchPattern":"try { dispatch(data); } catch (IllegalStateException e) { log.error(\"Unsupported message on span stream: {}\", data, e); }","preventionTips":["Route stat/URI-stat data to StatGrpcDataSender, spans only to the span sender","Type the data queues per sender to make wrong routing a compile-time issue","Extend onDispatch whenever new span-ish payloads are introduced"],"tags":["java","grpc","span"],"backgroundTag":"type-mismatch","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}