t8y2/dbx · error · IllegalArgumentException

Unknown method: " + method

Error message

Unknown method: " + method

What it means

KafkaAgent.dispatch routes an RPC method name to a handler via a switch over known mq_* methods. If the requested method is not one of the implemented operations, the default branch throws IllegalArgumentException listing the unknown method name.

Source

Thrown at agents/drivers/kafka/src/main/java/com/dbx/agent/kafka/KafkaAgent.java:164

            case "mq_alter_topic_config" -> alterTopicConfig(params);
            // Consumer groups
            case "mq_list_consumer_groups" -> listConsumerGroups(params);
            case "mq_get_consumer_group_snapshot" -> getConsumerGroupSnapshot(params);
            case "mq_describe_consumer_group" -> describeConsumerGroup(params);
            case "mq_delete_consumer_group" -> deleteConsumerGroup(params);
            case "mq_reset_consumer_group_offsets" -> resetConsumerGroupOffsets(params);
            case "mq_list_producers" -> listProducers(params);
            // Messages
            case "mq_peek_messages" -> peekMessages(params);
            case "mq_send_message" -> sendMessage(params);
            // ACLs
            case "mq_list_acls" -> listAcls(params);
            case "mq_create_acls" -> createAcls(params);
            case "mq_delete_acls" -> deleteAcls(params);
            // Cluster / monitoring
            case "mq_describe_cluster" -> describeCluster(params);
            case "mq_get_consumer_lag" -> getConsumerLag(params);
            default -> throw new IllegalArgumentException("Unknown method: " + method);
        };
    }

    // -----------------------------------------------------------------------
    // Lifecycle
    // -----------------------------------------------------------------------

    private static Object handshakeResult() {
        return new HandshakeResult(1, 1, CAPABILITIES);
    }

    private static Object connect(JsonObject params) throws Exception {
        JsonObject conn = resolveBrokerConnection(connectionObject(params));
        Map<String, String> previousKerberosSystemProperties = applyKerberosSystemProperties(conn);
        AdminClient nextAdmin = null;
        KafkaProducer<String, byte[]> nextProducer = null;
        try {
            nextAdmin = buildAdminClient(conn);

View on GitHub (pinned to c0390bff16)

Solutions

  1. Use one of the supported method names exactly as defined in the dispatch switch (snake_case, mq_ prefix)
  2. Check the agent version — if the method exists in a newer release, upgrade the deployed agent
  3. Log/inspect the method value being sent; validate the method list client-side against the agent's supported operations

Example fix

// before
agent.result(Map.of("method", "mq_listTopicAcls", "params", ...));
// after
agent.result(Map.of("method", "mq_list_acls", "params", ...));
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("mq_list_acls","mq_create_acls","mq_delete_acls","mq_describe_cluster","mq_get_consumer_lag" /* ... */);
if (!supported.contains(method)) throw new IllegalArgumentException("unsupported method: " + method);

Try / catch

try {
    return agent.result(params);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unknown method:")) {
        // surface allowed method list to the caller
    }
    throw e;
}

Prevention

When it happens

Trigger: Invoking the agent's result()/dispatch() with a method string that is not in the supported mq_* set (typo, unsupported op, method from a newer client against an older agent).

Common situations: Typo like 'mq_listAcls' vs 'mq_list_acls'; client and agent version skew (new mq_* method not present in deployed agent); dynamically built method names from config.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/2d53fc296ea61095. Report an issue: GitHub.