{"record":{"id":"8e5a7ba5c94e55cc","repo":"pinpoint-apm/pinpoint","slug":"unknown-command-type","errorCode":null,"errorMessage":"unknown command type ","messagePattern":"unknown command type ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/ReconnectExecutor.java","lineNumber":61,"sourceCode":"\n    private void execute0(Runnable command) {\n        Objects.requireNonNull(command, \"command\");\n\n        if (shutdown) {\n            logger.debug(\"already shutdown\");\n            return;\n        }\n        if (command instanceof ReconnectJob) {\n            ReconnectJob reconnectJob = (ReconnectJob) command;\n            logger.info(\"execute reconnectJob({})\", reconnectJob);\n            try {\n                scheduledExecutorService.schedule(reconnectJob, reconnectJob.nextInterval(), TimeUnit.MILLISECONDS);\n            } catch (RejectedExecutionException e) {\n                final long failCount = rejectedCounter.incrementAndGet();\n                logger.info(\"{} reconnectJob scheduled fail {}\", command, failCount);\n            }\n        } else {\n            throw new IllegalArgumentException(\"unknown command type \" + command);\n        }\n    }\n\n    public void close() {\n        shutdown = true;\n    }\n\n    public Reconnector newReconnector(Runnable reconnectJob) {\n        Objects.requireNonNull(reconnectJob, \"reconnectJob\");\n        if (logger.isInfoEnabled()) {\n            logger.info(\"newReconnector({})\", reconnectJob);\n        }\n\n        final Executor dispatch = new Executor() {\n            @Override\n            public void execute(Runnable command) {\n                ReconnectExecutor.this.execute0(command);\n            }","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/ReconnectExecutor.java#L43-L79","documentation":"ReconnectExecutor.execute0 dispatches on the ReconnectCommand's type and throws IllegalArgumentException when the command type is not one it understands. This guards against unknown/unimplemented reconnect command variants reaching the scheduler loop.","triggerScenarios":"Calling execute0 (via execute) with a ReconnectCommand whose type enum value is new/unknown to this executor's if/else chain — e.g. after adding a new command type without updating the dispatch.","commonSituations":"Version mismatch where a newer profiler module creates a command type an older ReconnectExecutor doesn't handle, or custom reconnect logic introducing a new command without extending execute0.","solutions":["Update ReconnectExecutor.execute0 to handle the new command type in its dispatch","Ensure all profiler modules use a consistent version so command types match","Verify custom ReconnectCommand implementations use a supported type"],"exampleFix":"// before\n} else {\n    throw new IllegalArgumentException(\"unknown command type \" + command);\n}\n// after\n} else if (command instanceof MyNewReconnectCommand) {\n    scheduleMyNewCommand((MyNewReconnectCommand) command);\n} else {\n    throw new IllegalArgumentException(\"unknown command type \" + command);\n}","handlingStrategy":"try-catch","validationCode":"if (!SUPPORTED_COMMAND_TYPES.contains(command.getType())) { throw new IllegalArgumentException(\"Unsupported reconnect command: \" + command.getType()); }","typeGuard":"boolean isSupportedCommand(ReconnectCommand c) { return c instanceof ChannelzReconnectCommand || c instanceof StateReconnectCommand; }","tryCatchPattern":"try { reconnectExecutor.execute(command); } catch (IllegalArgumentException e) { log.error(\"Reconnect command not supported: {}\", command, e); }","preventionTips":["Keep profiler modules on matching versions so command types align","When adding a ReconnectCommand subtype, update execute0's dispatch in the same change","Cover execute0 with exhaustive-switch unit tests"],"tags":["java","grpc","reconnect"],"backgroundTag":"invalid-enum-value","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"}