Relationships
#4826 workflow evaluate: guard on a forEach step is over-resolved to a boolean and fails schema validation
Opened by kneel · 11/16/2026· Shipped 11/17/2026
swamp: 20261111.001635.0
Symptom: swamp workflow evaluate <wf> fails with jobs[0].steps[N].guard: Invalid input: expected string, received boolean when the guarded step is a forEach step carrying guard: ${{ <bool expr> }} (e.g. ${{ !inputs.apply }}).
Observed facts:
- A non-forEach step with the identical guard evaluates cleanly, and the evaluated output file preserves the guard as a string template:
guard: '${{ !inputs.publishContent }}'. - A forEach step with
guard: ${{ !inputs.apply }}fails evaluate with the error above, under both default inputs and--input apply=true(so it is not the resolved boolean's value). validatepasses; the workflow runs correctly (a guard is a boolean at runtime -- a truthy guard skips).
Inferred root cause (from the evaluated output, not source): evaluate expands forEach steps and resolves their inner expressions including guard to concrete values, then re-validates the resolved document against the authoring schema where guard is typed as a string. Non-forEach guards are left as ${{ }} string templates and pass; forEach guards resolve to a boolean and violate the string type.
Impact: evaluate cannot validate an otherwise-correct workflow that guards a forEach step, and the error reads like an authoring mistake when the workflow is fine. Low severity, but misleading.
Suggested fix: on forEach steps, treat guard like non-forEach steps (leave it as a string template), or validate a resolved guard as string | boolean.
Shipped
Click a lifecycle step above to view its details.
zack commented 11/17/2026, 4:40:16 PM
Thanks @kneel for reporting this! We shipped: A guard is skipped when workflow expressions are evaluated, but substitution is keyed by raw expression text, so a guard whose text also appears in another field receives that field's evaluated value and fails the step schema as a boolean. Both workflow evaluate and workflow run fail. Fix: skip guard paths during substitution on both paths, as deferred task targets already are, so a guard always stays authored text and is decided at step time.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.