alibaba/arthas · error · IllegalArgumentException
methodPattern is required for record operation
Error message
methodPattern is required for record operation
What it means
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.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/mcp/tool/function/monitor200/TimeTunnelTool.java:115
". Supported actions: record(t), list(l), info(i), search(s), replay(p), delete(d), deleteAll(da)");
}
return executeStreamable(toolContext, cmd.toString(), execCount, DEFAULT_POLL_INTERVAL_MS, timeoutSeconds * 1000,
"TimeTunnel recording completed successfully");
}
/**
* 验证参数
*/
private void validateParameters(String action, String classPattern, String methodPattern,
Integer index, String searchExpression) {
switch (action) {
case "record":
if (classPattern == null || classPattern.trim().isEmpty()) {
throw new IllegalArgumentException("classPattern is required for record operation");
}
if (methodPattern == null || methodPattern.trim().isEmpty()) {
throw new IllegalArgumentException("methodPattern is required for record operation");
}
break;
case "info":
case "replay":
if (index == null) {
throw new IllegalArgumentException(action + " operation requires index parameter");
}
break;
case "search":
if (searchExpression == null || searchExpression.trim().isEmpty()) {
throw new IllegalArgumentException("search operation requires searchExpression parameter");
}
break;
case "delete":
if (index == null) {
throw new IllegalArgumentException("delete operation requires index parameter");
}
break;View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Provide methodPattern with a method name expression (e.g., primeFactors or *method).
- Use '*' as methodPattern to match all methods in the class.
Example fix
// before tt(action="record", classPattern="demo.MathGame") // after tt(action="record", classPattern="demo.MathGame", methodPattern="primeFactors")
Defensive patterns
Strategy: validation
Validate before calling
// Before calling tt record, validate methodPattern
if ("record".equals(normalizedAction)
&& (methodPattern == null || methodPattern.trim().isEmpty())) {
throw new IllegalArgumentException("methodPattern is required for tt record");
} Try / catch
try {
String result = timeTunnel(action, classPattern, methodPattern, ...);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("methodPattern")) {
// methodPattern missing for record
}
} Prevention
- 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.
When it happens
Trigger: Calling tt with action=record, a valid classPattern, but methodPattern is null or blank.
Common situations: User provides the class but forgets the method name; assumes '*' is the default.
Related errors
- classPattern is required for record operation
- ${action} operation requires index parameter
- search operation requires searchExpression parameter
- delete operation requires index parameter
- Unsupported action: ${action}
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/5c135c53521a7ef4.
Report an issue: GitHub.