{"record":{"id":"ffb1b4e85169ec2f","repo":"alibaba/arthas","slug":"action-is-required","errorCode":null,"errorMessage":"action is required","messagePattern":"action is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/ProfilerTool.java","lineNumber":223,"sourceCode":"\n        addOption(cmd, \"--title\", title);\n        addOption(cmd, \"--minwidth\", minwidth);\n        addFlag(cmd, \"--reverse\", reverse);\n        addFlag(cmd, \"--total\", total);\n\n        addOption(cmd, \"--chunksize\", chunksize);\n        addOption(cmd, \"--chunktime\", chunktime);\n        addOption(cmd, \"--loop\", loop);\n        addOption(cmd, \"--timeout\", timeout);\n        addOption(cmd, \"--duration\", duration);\n\n        logger.info(\"Executing profiler command: {}\", cmd);\n        return executeSync(toolContext, cmd.toString());\n    }\n\n    private static String normalizeAction(String action) {\n        if (action == null || action.trim().isEmpty()) {\n            throw new IllegalArgumentException(\"action is required\");\n        }\n\n        String input = action.trim();\n        for (String supported : SUPPORTED_ACTIONS) {\n            if (supported.equalsIgnoreCase(input)) {\n                return supported;\n            }\n        }\n\n        StringBuilder supportedList = new StringBuilder();\n        for (int i = 0; i < SUPPORTED_ACTIONS.length; i++) {\n            if (i > 0) {\n                supportedList.append(\", \");\n            }\n            supportedList.append(SUPPORTED_ACTIONS[i]);\n        }\n        throw new IllegalArgumentException(\"Unsupported action: \" + input + \". Supported actions: \" + supportedList);\n    }","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/ProfilerTool.java#L205-L241","documentation":"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.","triggerScenarios":"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.","commonSituations":"MCP client omits the action field; serialization drops a null field; field name mismatch.","solutions":["Provide a valid profiler action: start, resume, stop, dump, status, meminfo, list, version, load, execute, dumpCollapsed, dumpFlat, dumpTraces, getSamples, or actions.","Verify the MCP client sends the action field with the correct key name.","Use action=actions to discover all supported actions if unsure."],"exampleFix":"// before\nprofiler(action=\"\")\n// after\nprofiler(action=\"start\", event=\"cpu\")","handlingStrategy":"validation","validationCode":"// Before calling profiler, validate action\nif (action == null || action.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"action is required for profiler\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String result = profiler(action, ...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().equals(\"action is required\")) {\n        // action was null or blank — fix the caller\n    }\n}","preventionTips":["Always include the action field when calling the profiler MCP tool.","Use action=actions to discover valid values at runtime if unsure.","Validate that action is non-blank client-side."],"tags":["profiler","required-param","validation","arthas-mcp"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}