apache/dubbo · error · IllegalArgumentException
Unknown unit '${suffix}'
Error message
Unknown unit '${suffix}' What it means
Thrown by DurationStyle.TimeUnit.fromSuffix(suffix) when the suffix string does not case-insensitively match any of the supported suffixes: ns, us, ms, s, m, h, d. Called by SIMPLE.parse when a value like "100ms" is split into a number and a suffix that is then looked up.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/convert/StringToDurationConverter.java:233
public static TimeUnit fromChronoUnit(ChronoUnit chronoUnit) {
if (chronoUnit == null) {
return TimeUnit.MILLIS;
}
for (TimeUnit candidate : values()) {
if (candidate.chronoUnit == chronoUnit) {
return candidate;
}
}
throw new IllegalArgumentException("Unknown unit " + chronoUnit);
}
public static TimeUnit fromSuffix(String suffix) {
for (TimeUnit candidate : values()) {
if (candidate.suffix.equalsIgnoreCase(suffix)) {
return candidate;
}
}
throw new IllegalArgumentException("Unknown unit '" + suffix + "'");
}
}
}
}
View on GitHub (pinned to 3a3043227f)
Solutions
- Use the exact short suffix: ns (nanos), us (micros), ms (millis), s (seconds), m (minutes), h (hours), d (days).
- If you need a unit not in the list (weeks, months), convert to days or hours manually.
- Omit the suffix entirely to use the default unit (milliseconds).
Example fix
// before dubbo.provider.timeout=100sec // after dubbo.provider.timeout=100s
Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> VALID = Set.of("ns","us","ms","s","m","h","d");
if (suffix != null && !VALID.contains(suffix.toLowerCase())) {
// unknown suffix — reject or map
} Type guard
static boolean isValidSuffix(String s) {
return s != null && Set.of("ns","us","ms","s","m","h","d").contains(s.toLowerCase());
} Try / catch
try {
return TimeUnit.fromSuffix(suffix);
} catch (IllegalArgumentException e) {
return TimeUnit.MILLIS; // default fallback
} Prevention
- Use exact short suffixes: ns, us, ms, s, m, h, d.
- Omit suffix to default to milliseconds.
- Validate suffixes in config at startup.
When it happens
Trigger: A duration value matches the SIMPLE pattern ([+-]?\d+)([a-zA-Z]{0,2}) and contains a suffix, but the suffix is not one of the 7 recognized abbreviations. Examples: "100sec", "100min", "100hr", "100w" (weeks not supported), "100mo".
Common situations: Using full or alternate unit names instead of the short abbreviations. Common confusions: 'sec' instead of 's', 'min' instead of 'm', 'hr' instead of 'h', 'wk' instead of nothing (weeks unsupported).
Related errors
- '${value}' is not a valid duration
- Unknown unit ${chronoUnit}
- '${value}' is not a valid simple duration
- '${value}' is not a valid ISO-8601 duration
- The source String is more than one character!
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/8d4d947feb53dd88.
Report an issue: GitHub.