alibaba/arthas · error · IllegalArgumentException
sizeLimit must be greater than 0.
Error message
sizeLimit must be greater than 0.
What it means
Thrown by checkArguments() in the `tt` (time tunnel) command when the --sizeLimit option is non-null and <= 0. validateSizeLimit() returns this message and checkArguments() wraps it in IllegalArgumentException. sizeLimit controls how many time fragments the tunnel can record, so it must be a positive integer.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/command/monitor200/TimeTunnelCommand.java:250
private boolean hasSearchExpress() {
return !StringUtils.isEmpty(searchExpress);
}
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");
}
}
// 一个参数都没有是不行滴View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Set --sizeLimit to a positive integer (e.g. the default), or omit it to use the default.
- If you want a large buffer, pass a large positive value rather than 0.
Example fix
// before tt -t --class-pattern demo.MathGame --method-pattern prime --sizeLimit 0 // after tt -t --class-pattern demo.MathGame --method-pattern prime --sizeLimit 1000
Defensive patterns
Strategy: validation
Validate before calling
static String checkSizeLimit(Integer sizeLimit) {
return (sizeLimit != null && sizeLimit <= 0)
? "sizeLimit must be > 0" : null;
} Type guard
null
Try / catch
null
Prevention
- Pass a positive --sizeLimit or omit it for the default.
- Do not use 0 to mean 'unlimited'.
When it happens
Trigger: Running `tt --sizeLimit 0` or `tt --sizeLimit -1` (e.g. `tt -t --class-pattern X --method-pattern Y --sizeLimit 0`).
Common situations: Passing 0 intending 'unlimited' (Arthas uses a positive integer, not 0, for limits); misconfigured scripting defaulting sizeLimit to 0; sign error.
Related errors
- Too many line numbers, maximum is 256.
- Time fragment index is expected, please type -i to specify
- Invalid line number: {}
- Line number must be greater than 0: {}
- Class-pattern is expected, please type the wildcard expressi
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/c14fb632f81f9bb0.
Report an issue: GitHub.