Workflow tool: args delivered inconsistently as object vs JSON-encoded string (silent empty output)

Resolved 💬 2 comments Opened Jun 10, 2026 by gmanch94 Closed Jun 14, 2026

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-29fargs arrived as an object; args.subsystem defined; ran normally (~27 agents).
  • Run wf_f1a455ce-d46 — identical call shape (larger, with a nested top-level areas array); every args.* interpolated as the literal "undefined" → empty register, no error. Consistent with args being a string.
  • Run wf_c75cb967-1ce — added throw new Error('... got ' + JSON.stringify(args)) as a guard; it threw, showing args was a JSON string (escaped \" / \n), confirming string delivery.

Expected vs actual

  • Expected: args delivered 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)

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗