alibaba/arthas · error · IllegalArgumentException
Class-pattern is expected, please type the wildcard expressi
Error message
Class-pattern is expected, please type the wildcard expression to match
What it means
Thrown by checkArguments() in the `tt` command when the record mode (-t) is active but no class-pattern is provided. Time-tunnel recording must match a class via a wildcard expression, so a non-empty class-pattern is mandatory.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java:261
/**
* 检查参数是否合法
*/
private void checkArguments() {
String validateError = validateSizeLimit(sizeLimit);
if (validateError != null) {
throw new IllegalArgumentException(validateError);
}
// 检查d/p参数是否有i参数配套
if ((isDelete || isPlay) && null == index) {
throw new IllegalArgumentException("Time fragment index is expected, please type -i to specify");
}
// 在t参数下class-pattern,method-pattern
if (isTimeTunnel) {
if (StringUtils.isEmpty(classPattern)) {
throw new IllegalArgumentException("Class-pattern is expected, please type the wildcard expression to match");
}
if (StringUtils.isEmpty(methodPattern)) {
throw new IllegalArgumentException("Method-pattern is expected, please type the wildcard expression to match");
}
}
// 一个参数都没有是不行滴
if (null == index && !isTimeTunnel && !isDeleteAll && StringUtils.isEmpty(watchExpress)
&& !isList && StringUtils.isEmpty(searchExpress)) {
throw new IllegalArgumentException("Argument(s) is/are expected, type 'help tt' to read usage");
}
}
/*
* 记录时间片段
*/
int putTimeTunnel(TimeFragment tt) {
int indexOfSeq = sequence.getAndIncrement();View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Add `--class-pattern <wildcard>` (e.g. the FQN or a wildcard like demo.MathGame).
- Use `tt --help` to confirm the required options for record mode.
Example fix
// before tt -t --method-pattern primeFactors // after tt -t --class-pattern demo.MathGame --method-pattern primeFactors
Defensive patterns
Strategy: validation
Validate before calling
if (isTimeTunnel && (classPattern == null || classPattern.trim().isEmpty())) {
fail("-t requires --class-pattern");
} Type guard
null
Try / catch
null
Prevention
- Always supply --class-pattern when using -t.
- Use the FQN or a wildcard expression.
When it happens
Trigger: Running `tt -t` without `--class-pattern`, e.g. `tt -t --method-pattern prime` with the class missing.
Common situations: Forgetting the class-pattern; assuming -t takes positional args; passing an empty --class-pattern "".
Related errors
- Method-pattern is expected, please type the wildcard express
- Time fragment index is expected, please type -i to specify
- Argument(s) is/are expected, type 'help tt' to read usage
- sizeLimit must be greater than 0.
- 必须提供 path 或 cursor
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/744d27133881eff3.
Report an issue: GitHub.