Skip to content

fix(wait-task): accept ISO-8601 duration and fix misleading error message - #1474

Open
shaileshpadave wants to merge 3 commits into
mainfrom
fix/issue-1310-wait-duration-error-message
Open

fix(wait-task): accept ISO-8601 duration and fix misleading error message#1474
shaileshpadave wants to merge 3 commits into
mainfrom
fix/issue-1310-wait-duration-error-message

Conversation

@shaileshpadave

Copy link
Copy Markdown
Contributor

What

A WAIT task with "duration": "PT1S" (ISO-8601) failed with "Either date or duration is passed as null" — a message that implies the field was absent, when it was actually present but in an unsupported format.

Two changes:

  1. DateTimeUtils.parseDuration() — after the custom format ("1s", "2m") fails to match, fall back to java.time.Duration.parse() so ISO-8601 durations like "PT1S", "P5D", "PT1H30M" work natively.

  2. WorkflowTaskTypeConstraint — when parseDuration() still throws (genuinely invalid input), surface the actual error message instead of the misleading "passed as null" message.

Fixes #1310

How to verify

  1. Define a workflow with a WAIT task using ISO-8601 duration:
    { "type": "WAIT", "name": "wait1", "taskReferenceName": "wait_ref",
      "inputParameters": { "duration": "PT1S" } }
  2. Before fix: task fails immediately with "Either date or duration is passed as null".
  3. After fix: task waits 1 second and completes normally.
  4. To test the error message fix: use an invalid value like "duration": "PT" — the error now reads "Not valid duration: PT" instead of blaming null.

…nvalid format

parseDuration() only accepted the custom "1s"/"2m"/"1h 30m" format. Using
ISO-8601 (e.g. "PT1S") threw an IllegalArgumentException that got caught and
re-thrown with the misleading "Either date or duration is passed as null" message.

Now parseDuration() tries the custom format first, then falls back to
Duration.parse() for ISO-8601. If both fail, the constraint surfaces the actual
error message from parseDuration() instead of the null-blame message.

Fixes #1310
@v1r3n
v1r3n requested a review from mp-orkes August 4, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WAIT task: misleading error 'date or duration is null' when ISO-8601 duration format is used

2 participants