{"record":{"id":"5c135c53521a7ef4","repo":"alibaba/arthas","slug":"methodpattern-is-required-for-record-operation","errorCode":null,"errorMessage":"methodPattern is required for record operation","messagePattern":"methodPattern is required for record operation","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/TimeTunnelTool.java","lineNumber":115,"sourceCode":"                        \". Supported actions: record(t), list(l), info(i), search(s), replay(p), delete(d), deleteAll(da)\");\n        }\n\n        return executeStreamable(toolContext, cmd.toString(), execCount, DEFAULT_POLL_INTERVAL_MS, timeoutSeconds * 1000,\n                \"TimeTunnel recording completed successfully\");\n    }\n\n    /**\n     * 验证参数\n     */\n    private void validateParameters(String action, String classPattern, String methodPattern, \n                                   Integer index, String searchExpression) {\n        switch (action) {\n            case \"record\":\n                if (classPattern == null || classPattern.trim().isEmpty()) {\n                    throw new IllegalArgumentException(\"classPattern is required for record operation\");\n                }\n                if (methodPattern == null || methodPattern.trim().isEmpty()) {\n                    throw new IllegalArgumentException(\"methodPattern is required for record operation\");\n                }\n                break;\n            case \"info\":\n            case \"replay\":\n                if (index == null) {\n                    throw new IllegalArgumentException(action + \" operation requires index parameter\");\n                }\n                break;\n            case \"search\":\n                if (searchExpression == null || searchExpression.trim().isEmpty()) {\n                    throw new IllegalArgumentException(\"search operation requires searchExpression parameter\");\n                }\n                break;\n            case \"delete\":\n                if (index == null) {\n                    throw new IllegalArgumentException(\"delete operation requires index parameter\");\n                }\n                break;","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/TimeTunnelTool.java#L97-L133","documentation":"The record action requires methodPattern in addition to classPattern. Arthas needs both to identify the exact method(s) to record. This check fires only after classPattern has already passed validation.","triggerScenarios":"Calling tt with action=record, a valid classPattern, but methodPattern is null or blank.","commonSituations":"User provides the class but forgets the method name; assumes '*' is the default.","solutions":["Provide methodPattern with a method name expression (e.g., primeFactors or *method).","Use '*' as methodPattern to match all methods in the class."],"exampleFix":"// before\ntt(action=\"record\", classPattern=\"demo.MathGame\")\n// after\ntt(action=\"record\", classPattern=\"demo.MathGame\", methodPattern=\"primeFactors\")","handlingStrategy":"validation","validationCode":"// Before calling tt record, validate methodPattern\nif (\"record\".equals(normalizedAction)\n        && (methodPattern == null || methodPattern.trim().isEmpty())) {\n    throw new IllegalArgumentException(\"methodPattern is required for tt record\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String result = timeTunnel(action, classPattern, methodPattern, ...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"methodPattern\")) {\n        // methodPattern missing for record\n    }\n}","preventionTips":["Always provide both classPattern and methodPattern for record.","Use '*' as methodPattern to match all methods in the target class.","Validate both parameters client-side before calling tt."],"tags":["tt","required-param","validation","timetunnel","arthas-mcp"],"backgroundTag":null,"analyzedSha":"21cf2e9ba52b305290be7223b980ff504bb9cb5b","analyzedAt":"2026-08-14T00:57:07.243Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}