alibaba/arthas · error · IllegalArgumentException
Time fragment index is expected, please type -i to specify
Error message
Time fragment index is expected, please type -i to specify
What it means
Thrown by checkArguments() in the `tt` command when a delete (-d) or play/replay (-p) action is requested but no time fragment index (-i) is supplied. Each recorded time fragment is identified by an integer index; you must specify which one to delete or replay.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java:255
static String validateSizeLimit(Integer sizeLimit) {
if (sizeLimit != null && sizeLimit.intValue() <= 0) {
return "sizeLimit must be greater than 0.";
}
return null;
}
/**
* 检查参数是否合法
*/
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");
}
}View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Add `-i <index>` where <index> is the time fragment id shown by `tt -l`.
- Run `tt -l` first to list recorded fragments and their indices.
- To delete all fragments use the delete-all option instead of -d.
Example fix
// before tt -d // after tt -i 1000 -d
Defensive patterns
Strategy: validation
Validate before calling
if ((isDelete || isPlay) && index == null) {
fail("-d/-p require -i <index>");
} Type guard
null
Try / catch
null
Prevention
- Always pair -d/-p with -i <index>.
- List fragments first with `tt -l` to find the index.
When it happens
Trigger: Running `tt -d` or `tt -p` without `-i <index>`, e.g. `tt -d` alone, or `tt -p --replay-times 2` without the index.
Common situations: Forgetting the -i index; assuming -d deletes all (use -D/--delete-all for that); index variable left null in a script.
Related errors
- sizeLimit must be greater than 0.
- Class-pattern is expected, please type the wildcard expressi
- Method-pattern is expected, please type the wildcard express
- Argument(s) is/are expected, type 'help tt' to read usage
- 必须提供 path 或 cursor
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/fa4d0513f7736276.
Report an issue: GitHub.