alibaba/arthas · warning · IllegalArgumentException
Line range syntax is not supported in the first version: {}
Error message
Line range syntax is not supported in the first version: {} What it means
Thrown as IllegalArgumentException by LineCommand.parseLines when a line-spec value contains a dash ('-'), indicating a range (e.g. '10-20'). Range syntax is intentionally not implemented in this first version of the command — only discrete, comma-separated single line numbers are accepted. The offending value is echoed.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/command/monitor200/LineCommand.java:288
}
static Set<Integer> parseLines(List<String> lineSpecs) {
if (lineSpecs == null || lineSpecs.isEmpty()) {
throw new IllegalArgumentException("The --line option is required unless --list-lines is used.");
}
Set<Integer> result = new LinkedHashSet<Integer>();
for (String lineSpec : lineSpecs) {
if (StringUtils.isEmpty(lineSpec)) {
continue;
}
String[] parts = lineSpec.split(",");
for (String part : parts) {
String value = part.trim();
if (value.length() == 0) {
continue;
}
if (value.indexOf('-') >= 0) {
throw new IllegalArgumentException("Line range syntax is not supported in the first version: "
+ value);
}
final int lineNumber;
try {
lineNumber = Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid line number: " + value);
}
if (lineNumber <= 0) {
throw new IllegalArgumentException("Line number must be greater than 0: " + value);
}
result.add(lineNumber);
if (result.size() > MAX_LINE_COUNT) {
throw new IllegalArgumentException("Too many line numbers, maximum is " + MAX_LINE_COUNT + ".");
}
}
}
if (result.isEmpty()) {View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Replace the range with an explicit comma-separated list of single lines (e.g. '10,11,12,...,20').
- If you need many lines, generate the comma list programmatically.
- Check release notes for a newer Arthas version that may have added range support.
Example fix
// before line com.example.Foo --line 10-20 // after line com.example.Foo --line 10,11,12,13,14,15,16,17,18,19,20
Defensive patterns
Strategy: validation
Validate before calling
if (value.indexOf('-') >= 0) {
// expand to a comma-separated list of single lines before passing to parseLines
} Type guard
static boolean isDiscreteLineSpec(String s) { return s != null && s.indexOf('-') < 0; } Try / catch
try { Set<Integer> lines = LineCommand.parseLines(lineSpecs); } catch (IllegalArgumentException e) { // expand ranges into explicit lists } Prevention
- Use comma-separated single line numbers, not ranges.
- Generate the comma list programmatically when many lines are needed.
- Check release notes for newer versions that may support range syntax.
When it happens
Trigger: Pass a --line value using range syntax such as '10-20', '5-10', or any token containing '-'. The indexOf('-') check trips before numeric parsing.
Common situations: User assumes range syntax is supported (common in other tools' breakpoint commands); copy-paste of a range from documentation of a different tool.
Related errors
- '{s}' is not a valid size. Should be numeric value followed
- '{s}' is not a valid timespan. Shoule be numeric value follo
- {optionName} must not be blank.
- {optionName} must be greater than 0.
- {optionName} is invalid: {value}
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/6f2ce07b7e3471ea.
Report an issue: GitHub.