Workflow tool: args delivered inconsistently as object vs JSON-encoded string (silent empty output)
Tool: Workflow (background dynamic workflows), Claude Code
Summary
The args value passed to a Workflow invocation reaches the script's args global sometimes as a parsed object and sometimes as a JSON-encoded string. The documented contract ("Pass arrays/objects as actual JSON values, NOT as a JSON-encoded string") implies the script receives an object. When it arrives as a string instead, const A = args; A.field is silently undefined, and the workflow produces hollow/empty output with no error.
Repro (same session, same caller; args passed as a JSON object literal each time)
- Run
wf_a58a5a82-29f—argsarrived as an object;args.subsystemdefined; ran normally (~27 agents). - Run
wf_f1a455ce-d46— identical call shape (larger, with a nested top-levelareasarray); everyargs.*interpolated as the literal"undefined"→ empty register, no error. Consistent withargsbeing a string. - Run
wf_c75cb967-1ce— addedthrow new Error('... got ' + JSON.stringify(args))as a guard; it threw, showingargswas a JSON string (escaped\"/\n), confirming string delivery.
Expected vs actual
- Expected:
argsdelivered verbatim as the object passed in the tool call. - Actual: delivered as a JSON-encoded string on some runs.
Possible triggers (not isolated)
The failing runs both (a) re-invoked an edited scriptPath, and (b) had a larger / more deeply-nested args (a top-level array of objects). Either could be the trigger; I did not isolate which.
Impact
Silent — no error, just empty results — unless the script defends against it.
Workaround
let A = args
if (typeof A === 'string') A = JSON.parse(A)
Environment
Claude Code · model Opus 4.8 (1M context) · win32 (Windows 11)
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗