{"record":{"id":"a8cf110b30fc77c7","repo":"alibaba/arthas","slug":"classpattern-is-required-for-record-operation","errorCode":null,"errorMessage":"classPattern is required for record operation","messagePattern":"classPattern 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":112,"sourceCode":"                break;\n            default:\n                throw new IllegalArgumentException(\"Unsupported action: \" + ttAction +\n                        \". 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) {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/alibaba/arthas/blob/21cf2e9ba52b305290be7223b980ff504bb9cb5b/core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/TimeTunnelTool.java#L94-L130","documentation":"The record action requires classPattern to identify which class to instrument for recording method invocations. Without it Arthas cannot set up the TimeTunnel watch point.","triggerScenarios":"Calling the tt tool with action=record (the default when action is omitted) while classPattern is null or blank. Validated in validateParameters at line 111-113.","commonSituations":"User omits classPattern expecting a wildcard default; MCP client drops the field; user relies on the default action=record but forgets the required class argument.","solutions":["Provide classPattern with a class name expression (e.g., demo.MathGame or *Test).","Remember that action defaults to record when omitted, so classPattern and methodPattern are almost always needed.","If you intended a different action (list, info, etc.), specify it explicitly."],"exampleFix":"// before\ntt(action=\"record\", methodPattern=\"primeFactors\")\n// after\ntt(action=\"record\", classPattern=\"demo.MathGame\", methodPattern=\"primeFactors\")","handlingStrategy":"validation","validationCode":"// Before calling tt record, validate classPattern\nif (\"record\".equals(normalizedAction)\n        && (classPattern == null || classPattern.trim().isEmpty())) {\n    throw new IllegalArgumentException(\"classPattern 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(\"classPattern\")) {\n        // classPattern missing for record — provide a class name expression\n    }\n}","preventionTips":["Always provide classPattern when using action=record (the default).","Remember that omitting action defaults to record, so classPattern/methodPattern are needed.","Use wildcard patterns like *Test for broad class matching."],"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"}