pinpoint-apm/pinpoint · error · IllegalArgumentException

unknown command type

Error message

unknown command type 

What it means

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.

Source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/sender/grpc/ReconnectExecutor.java:61

    private void execute0(Runnable command) {
        Objects.requireNonNull(command, "command");

        if (shutdown) {
            logger.debug("already shutdown");
            return;
        }
        if (command instanceof ReconnectJob) {
            ReconnectJob reconnectJob = (ReconnectJob) command;
            logger.info("execute reconnectJob({})", reconnectJob);
            try {
                scheduledExecutorService.schedule(reconnectJob, reconnectJob.nextInterval(), TimeUnit.MILLISECONDS);
            } catch (RejectedExecutionException e) {
                final long failCount = rejectedCounter.incrementAndGet();
                logger.info("{} reconnectJob scheduled fail {}", command, failCount);
            }
        } else {
            throw new IllegalArgumentException("unknown command type " + command);
        }
    }

    public void close() {
        shutdown = true;
    }

    public Reconnector newReconnector(Runnable reconnectJob) {
        Objects.requireNonNull(reconnectJob, "reconnectJob");
        if (logger.isInfoEnabled()) {
            logger.info("newReconnector({})", reconnectJob);
        }

        final Executor dispatch = new Executor() {
            @Override
            public void execute(Runnable command) {
                ReconnectExecutor.this.execute0(command);
            }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Update ReconnectExecutor.execute0 to handle the new command type in its dispatch
  2. Ensure all profiler modules use a consistent version so command types match
  3. Verify custom ReconnectCommand implementations use a supported type

Example fix

// before
} else {
    throw new IllegalArgumentException("unknown command type " + command);
}
// after
} else if (command instanceof MyNewReconnectCommand) {
    scheduleMyNewCommand((MyNewReconnectCommand) command);
} else {
    throw new IllegalArgumentException("unknown command type " + command);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!SUPPORTED_COMMAND_TYPES.contains(command.getType())) { throw new IllegalArgumentException("Unsupported reconnect command: " + command.getType()); }

Type guard

boolean isSupportedCommand(ReconnectCommand c) { return c instanceof ChannelzReconnectCommand || c instanceof StateReconnectCommand; }

Try / catch

try { reconnectExecutor.execute(command); } catch (IllegalArgumentException e) { log.error("Reconnect command not supported: {}", command, e); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/8e5a7ba5c94e55cc. Report an issue: GitHub.