conductor-oss/conductor · error · IllegalArgumentException
Not valid duration: %s
Error message
Not valid duration: %s
What it means
Thrown by DateTimeUtils.parseDuration when the input string does not match the expected duration pattern. The pattern accepts combinations of days (d/days), hours (h/hrs/hours), minutes (m/mins/minutes), and seconds (s/secs/seconds), case-insensitive, with optional whitespace. Any string that doesn't conform — including ISO-8601 durations like 'PT5M' or values with units like milliseconds/weeks — will be rejected.
Source
Thrown at core/src/main/java/com/netflix/conductor/core/utils/DateTimeUtils.java:39
import org.apache.commons.lang3.time.DateUtils;
public class DateTimeUtils {
private static final String[] DATE_PATTERNS =
new String[] {"yyyy-MM-dd HH:mm", "yyyy-MM-dd HH:mm z", "yyyy-MM-dd"};
private static final Pattern DURATION_PATTERN =
Pattern.compile(
"""
\\s*(?:(\\d+)\\s*(?:days?|d))?\
\\s*(?:(\\d+)\\s*(?:hours?|hrs?|h))?\
\\s*(?:(\\d+)\\s*(?:minutes?|mins?|m))?\
\\s*(?:(\\d+)\\s*(?:seconds?|secs?|s))?\
\\s*""",
Pattern.CASE_INSENSITIVE);
public static Duration parseDuration(String text) {
Matcher m = DURATION_PATTERN.matcher(text);
if (!m.matches()) throw new IllegalArgumentException("Not valid duration: " + text);
int days = (m.start(1) == -1 ? 0 : Integer.parseInt(m.group(1)));
int hours = (m.start(2) == -1 ? 0 : Integer.parseInt(m.group(2)));
int mins = (m.start(3) == -1 ? 0 : Integer.parseInt(m.group(3)));
int secs = (m.start(4) == -1 ? 0 : Integer.parseInt(m.group(4)));
return Duration.ofSeconds((days * 86400) + (hours * 60L + mins) * 60L + secs);
}
public static Date parseDate(String date) throws ParseException {
return DateUtils.parseDate(date, DATE_PATTERNS);
}
}
View on GitHub (pinned to cf7c3e4a8a)
Solutions
- Use the supported duration shorthand format: days (d), hours (h), minutes (m), seconds (s) — e.g. '1h30m' or '2 days 4 hours'.
- Convert ISO-8601 durations to the supported format (e.g. 'PT5M' becomes '5m').
- Ensure the string includes at least one valid unit suffix — bare numbers are not accepted.
- Remove unsupported units (milliseconds, microseconds, weeks, months, years) from the duration string.
Example fix
// before
DateTimeUtils.parseDuration("PT1H30M") // throws
DateTimeUtils.parseDuration("500ms") // throws
// after
DateTimeUtils.parseDuration("1h30m") // ok
DateTimeUtils.parseDuration("90m") // ok Defensive patterns
Strategy: validation
Validate before calling
// Validate duration string format before calling parseDuration
private static final Pattern DURATION_PATTERN = Pattern.compile(
"\\s*(?:(\\d+)\\s*(?:days?|d))?"
+ "\\s*(?:(\\d+)\\s*(?:hours?|hrs?|h))?"
+ "\\s*(?:(\\d+)\\s*(?:minutes?|mins?|m))?"
+ "\\s*(?:(\\d+)\\s*(?:seconds?|secs?|s))?"
+ "\\s*", Pattern.CASE_INSENSITIVE);
if (!DURATION_PATTERN.matcher(durationStr).matches()) {
throw new IllegalArgumentException(
"Invalid duration format: '" + durationStr
+ "'. Use format like '1h30m', '2 days', '45s'.");
} Try / catch
try {
Duration d = DateTimeUtils.parseDuration(text);
} catch (IllegalArgumentException e) {
// Provide a helpful message with the accepted format
throw new IllegalArgumentException(
"Duration '" + text + "' is invalid. Supported: days(d), hours(h), minutes(m), seconds(s)."
+ " Example: '1h30m'.", e);
} Prevention
- Use Conductor's shorthand format (d/h/m/s) for durations, not ISO-8601 (PT...).
- Always include a unit suffix — bare numbers are rejected.
- Document the accepted format in client SDKs and configuration guides.
When it happens
Trigger: Passing a duration string to parseDuration that doesn't match the regex: e.g. 'PT5M' (ISO-8601), '1 week', '500ms', '12:30', or a completely malformed string. This method is called when parsing duration-type configuration properties and workflow timeout values.
Common situations: Using ISO-8601 duration format (PT1H30M) where Conductor expects its own shorthand format (1h30m). Typing 'ms' or 'millisecond' which the pattern doesn't support (minimum unit is seconds). Including unsupported units like 'weeks' or 'years'. Passing a numeric-only string like '60' without a unit suffix.
Related errors
- Skill registry is not available
- llmProvider not specified: {name}
- no configuration found for: {name}
- Bad/Unsupported schema? : {validationMessages}
- Agent Card resolved from %s does not advertise a JSON-RPC 'u
AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14).
Data as JSON: /api/errors/76f7d810ae1b151b.
Report an issue: GitHub.