t8y2/dbx · error · IllegalArgumentException

Unknown method: {method}

Error message

Unknown method: {method}

What it means

The catch-all at the end of JsonRpcServer.dispatch throws IllegalArgumentException('Unknown method: {method}') for any JSON-RPC method not matched by the preceding protocol handlers. It signals the client invoked a method this server build does not implement.

Source

Thrown at agents/common/src/main/java/com/dbx/agent/JsonRpcServer.java:337

            Type statementsType = new TypeToken<List<String>>() {}.getType();
            List<String> statements = gson.fromJson(params.get("statements"), statementsType);
            return agent.executeBatch(statements, stringOrNull(params, "schema"));
        }
        if (AgentProtocol.METHOD_DISCONNECT.equals(method)) {
            jdbcExecutor.closeAllQuerySessions();
            jdbcExecutor.closeAllTableReadSessions();
            agent.disconnect();
            lastConnectParams = null;
            return Collections.singletonMap("ok", true);
        }
        if (AgentProtocol.METHOD_SHUTDOWN.equals(method)) {
            jdbcExecutor.closeAllQuerySessions();
            jdbcExecutor.closeAllTableReadSessions();
            agent.disconnect();
            lastConnectParams = null;
            return Collections.singletonMap("ok", true);
        }
        throw new IllegalArgumentException("Unknown method: " + method);
    }

    private void switchCatalog(JsonObject params) throws Exception {
        String database = stringOrNull(params, "database");
        if (database != null && !database.trim().isEmpty() && agent.getConnection() != null) {
            String currentCatalog = null;
            try {
                currentCatalog = agent.getConnection().getCatalog();
            } catch (Exception ignored) {
            }
            if (currentCatalog == null || !currentCatalog.trim().equalsIgnoreCase(database.trim())) {
                try {
                    agent.getConnection().setCatalog(database);
                } catch (Exception ignored) {
                }
            }
        }
    }

View on GitHub (pinned to c0390bff16)

Solutions

  1. Check the exact method name against AgentProtocol constants supported by the running agent
  2. Upgrade the agent (server) to a version that implements the method your client calls
  3. Log/inspect the method string for typos or casing differences
  4. Add graceful client handling that lists supported methods before invoking

Example fix

// before
rpc.call("executeQuery"); // typo / unsupported
// after
rpc.call("jdbc.executeSql"); // method defined in AgentProtocol for this agent version
Defensive patterns

Strategy: type-guard

Validate before calling

// client-side allowlist mirroring AgentProtocol
Set<String> supported = Set.of("connect","disconnect","testConnection","validateConnection","connectionInfo", ...);
if (!supported.contains(method)) throw new UnsupportedOperationException(method);

Type guard

boolean isSupportedMethod(String m) { return AgentProtocol.ALL_METHODS.contains(m); }

Try / catch

try {
    return rpc.call(method, params);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Unknown method")) {
        return fallbackRpc.call(method, params); // newer agent version
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling a JSON-RPC method name that is misspelled, not part of AgentProtocol, or added only in a newer agent version than the one running.

Common situations: Client/server version skew (client expects newer methods); typo in method name; custom tools calling nonstandard method names; case-sensitivity mistakes in the method string.

Related errors


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