alibaba/arthas · warning · IllegalArgumentException
{optionName} must be greater than 0.
Error message
{optionName} must be greater than 0. What it means
Thrown as IllegalArgumentException by parseTimeMillis when the parsed duration (Long.parseLong(text) * multiplier) is <= 0. The numeric body parses fine but the resulting millisecond value is non-positive (e.g. 0, negative). A strictly positive duration is required.
Source
Thrown at core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderMetaspaceCommand.java:476
throw new IllegalArgumentException(optionName + " must not be blank.");
}
String text = value.trim().toLowerCase();
long multiplier = 1;
if (text.endsWith("ms")) {
text = text.substring(0, text.length() - 2).trim();
} else if (text.endsWith("s")) {
text = text.substring(0, text.length() - 1).trim();
multiplier = 1000;
} else if (text.endsWith("m")) {
text = text.substring(0, text.length() - 1).trim();
multiplier = 60 * 1000;
}
try {
long millis = Long.parseLong(text) * multiplier;
if (millis <= 0) {
throw new IllegalArgumentException(optionName + " must be greater than 0.");
}
return millis;
} catch (NumberFormatException e) {
throw new IllegalArgumentException(optionName + " is invalid: " + value);
}
}
private void logMappingSummary(MappingSummary summary) {
logger.debug("{} mapping summary, loadedClasses={}, candidateLoaders={}, emittedMappings={}, bootstrapClasses={}, arrayClasses={}, primitiveClasses={}, duplicateLoaderClasses={}",
DIAG_LOG_PREFIX, summary.loadedClassCount, summary.candidateLoaderCount, summary.emittedMappingCount,
summary.bootstrapClassCount, summary.arrayClassCount, summary.primitiveClassCount,
summary.duplicateLoaderClassCount);
}
private void logRecordingSummary(RecordingData data, long recordingSize) {
logger.debug("{} recording summary, fileSizeBytes={}, statsEvents={}, distinctStatsRows={}, mappingEvents={}, fallbackMappings={}, mappedLoaderIds={}, mappingEventsWithoutLoader={}, duplicateStatsRows={}",
DIAG_LOG_PREFIX, recordingSize, data.statsEventCount, data.statsRows.size(), data.mappingEventCount,
data.fallbackMappings.size(), data.mappingByLoaderId.size(), data.mappingEventWithoutLoaderCount,View on GitHub (pinned to 21cf2e9ba5)
Solutions
- Use a positive value: 1s, 500ms, 5m, etc.
- If you mean 'no interval', omit the option (use its default) instead of passing 0.
- Check for stray negative signs or zero defaults in config.
Example fix
// before classloader --refresh-interval 0s // after classloader --refresh-interval 5s
Defensive patterns
Strategy: validation
Validate before calling
long ms = parseMillisRaw(value);
if (ms <= 0) { // reject before calling; supply a positive duration } Type guard
static boolean isPositiveDuration(String s) {
if (s == null) return false;
try { return Long.parseLong(stripSuffix(s)) > 0; } catch (NumberFormatException e) { return false; }
} Try / catch
try { long ms = parseTimeMillis(value, optionName); } catch (IllegalArgumentException e) { /* prompt user for a value > 0 */ } Prevention
- Never pass 0 or negative durations; omit the option for the default.
- Audit config files for zero defaults.
- Validate duration is strictly positive before submission.
When it happens
Trigger: Pass a time option value of '0', '0s', '0m', '0ms', or a negative number like '-5s'. The multiplier (1 for ms, 1000 for s, 60000 for m) is applied, and millis <= 0 trips the guard.
Common situations: User intends 'disable' and passes 0; copy-paste mistake with a leading minus; default-of-zero from a misconfigured config file.
Related errors
- {optionName} is invalid: {value}
- {optionName} must not be blank.
- '{s}' is not a valid size. Should be numeric value followed
- '{s}' is not a valid timespan. Shoule be numeric value follo
- The --line option is required unless --list-lines is used.
AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14).
Data as JSON: /api/errors/7838bc359c366485.
Report an issue: GitHub.