alibaba/arthas · error · IllegalArgumentException

action is required

Error message

action is required

What it means

normalizeAction in the profiler tool rejects a null or blank action parameter. The action field is required and must identify one of the supported profiler subcommands.

Source

Thrown at core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/ProfilerTool.java:223

        addOption(cmd, "--title", title);
        addOption(cmd, "--minwidth", minwidth);
        addFlag(cmd, "--reverse", reverse);
        addFlag(cmd, "--total", total);

        addOption(cmd, "--chunksize", chunksize);
        addOption(cmd, "--chunktime", chunktime);
        addOption(cmd, "--loop", loop);
        addOption(cmd, "--timeout", timeout);
        addOption(cmd, "--duration", duration);

        logger.info("Executing profiler command: {}", cmd);
        return executeSync(toolContext, cmd.toString());
    }

    private static String normalizeAction(String action) {
        if (action == null || action.trim().isEmpty()) {
            throw new IllegalArgumentException("action is required");
        }

        String input = action.trim();
        for (String supported : SUPPORTED_ACTIONS) {
            if (supported.equalsIgnoreCase(input)) {
                return supported;
            }
        }

        StringBuilder supportedList = new StringBuilder();
        for (int i = 0; i < SUPPORTED_ACTIONS.length; i++) {
            if (i > 0) {
                supportedList.append(", ");
            }
            supportedList.append(SUPPORTED_ACTIONS[i]);
        }
        throw new IllegalArgumentException("Unsupported action: " + input + ". Supported actions: " + supportedList);
    }

View on GitHub (pinned to 21cf2e9ba5)

Solutions

  1. Provide a valid profiler action: start, resume, stop, dump, status, meminfo, list, version, load, execute, dumpCollapsed, dumpFlat, dumpTraces, getSamples, or actions.
  2. Verify the MCP client sends the action field with the correct key name.
  3. Use action=actions to discover all supported actions if unsure.

Example fix

// before
profiler(action="")
// after
profiler(action="start", event="cpu")
Defensive patterns

Strategy: validation

Validate before calling

// Before calling profiler, validate action
if (action == null || action.trim().isEmpty()) {
    throw new IllegalArgumentException("action is required for profiler");
}

Try / catch

try {
    String result = profiler(action, ...);
} catch (IllegalArgumentException e) {
    if (e.getMessage().equals("action is required")) {
        // action was null or blank — fix the caller
    }
}

Prevention

When it happens

Trigger: Calling the profiler tool with action omitted, null, empty string, or whitespace-only. The check at line 222 fires before any matching against the supported list.

Common situations: MCP client omits the action field; serialization drops a null field; field name mismatch.

Related errors


AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14). Data as JSON: /api/errors/ffb1b4e85169ec2f. Report an issue: GitHub.