{"record":{"id":"c8e60d234b5a50ee","repo":"pinpoint-apm/pinpoint","slug":"unsupported-message-c8e60d","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/StatGrpcDataSender.java","lineNumber":95,"sourceCode":"                final PStatMessage statMessage = PStatMessage.newBuilder().setAgentStat(agentStat).build();\n                stream.onNext(statMessage);\n                return;\n            }\n            if (message instanceof PCustomMetricMessage) {\n                final PCustomMetricMessage customMetricMessage = (PCustomMetricMessage) message;\n                logger.info(\"Message will not delivered. message:{}\", message);\n\n                return;\n            }\n            if (message instanceof PAgentUriStat) {\n                final PAgentUriStat agentUriStat = (PAgentUriStat) message;\n                final PStatMessage statMessage = PStatMessage.newBuilder().setAgentUriStat(agentUriStat).build();\n\n                // TODO remove comment\n                stream.onNext(statMessage);\n                return;\n            }\n            throw new IllegalStateException(\"unsupported message \" + message);\n        }\n    };\n\n    public StatGrpcDataSender(String host, int port,\n                              int executorQueueSize,\n                              MessageConverter<MetricType, GeneratedMessageV3> messageConverter,\n                              ReconnectExecutor reconnectExecutor,\n                              ChannelFactory channelFactory) {\n        super(host, port, executorQueueSize, messageConverter, channelFactory);\n        this.statStub = StatGrpc.newStub(managedChannel);\n\n        this.reconnectExecutor = Objects.requireNonNull(reconnectExecutor, \"reconnectExecutor\");\n        final Runnable reconnectJob = new NamedRunnable(ID) {\n            @Override\n            public void run() {\n                startStream();\n            }\n        };","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/StatGrpcDataSender.java#L77-L113","documentation":"StatGrpcDataSender's onDispatch consumer builds PStatMessage from queued MetricType data and throws IllegalStateException \"unsupported message\" when the converted message is not a stat type it supports (e.g. PAgentStat, PAgentUriStat). The stat gRPC stream only accepts stat messages.","triggerScenarios":"Dispatching a message through the stat sender whose converter output is not one of the handled PStat payloads — e.g. sending a PSpan or agent info through the stat stream.","commonSituations":"Swapped sender wiring (stat data to span sender or vice versa), a custom/updated MessageConverter returning an unexpected protobuf type, or new metric types not added to onDispatch's if/else chain.","solutions":["Send only stat/metric data to StatGrpcDataSender; route spans to SpanGrpcDataSender","Add the new metric type to onDispatch's conversion chain if it should go on the stat stream","Verify the configured MessageConverter<MetricType,...> produces the expected PStat payload types"],"exampleFix":"// before\nif (message instanceof PAgentUriStat) { ... }\nthrow new IllegalStateException(\"unsupported message \" + message);\n// after\nif (message instanceof PAgentUriStat) { ... }\nelse if (message instanceof PNewStatType) {\n    PStatMessage m = PStatMessage.newBuilder().setNewStat((PNewStatType) message).build();\n    stream.onNext(m);\n    return;\n}\nthrow new IllegalStateException(\"unsupported message \" + message);","handlingStrategy":"type-guard","validationCode":"if (!(messageConverter.toMessage(data) instanceof PStatPayload)) { throw new IllegalStateException(\"StatGrpcDataSender only accepts stat data\"); }","typeGuard":"GeneratedMessageV3 msg = messageConverter.toMessage(data);\nif (msg instanceof PAgentUriStat || msg instanceof PAgentStat) { /* safe to send as PStatMessage */ }","tryCatchPattern":"try { dispatch(data); } catch (IllegalStateException e) { log.error(\"Unsupported message on stat stream: {}\", data, e); }","preventionTips":["Separate span and stat senders behind distinct typed APIs","Add exhaustive tests for each MetricType to PStat payload mapping","Update onDispatch's type chain when adding new metrics"],"tags":["java","grpc","stat"],"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"}