Relationships
#1301 command/shell renders JSON-object stdout lines as the literal string 'undefined'
Opened by magistr · 7/20/2026· Shipped 7/20/2026
Summary
command/shell renders any stdout line that is a JSON object as the literal
string undefined in the log/console output. The stored resource is correct —
this is purely the rendering path — but it silently replaces real output with a
plausible-looking wrong value, which makes it actively misleading rather than
merely cosmetic.
Arrays and scalars render fine. Only objects are affected.
Reproduction
swamp model create command/shell probe
swamp model method run probe execute \
--input run='printf "%s\n" "plain line" "{\"a\":1}" "{}" "[1,2]" "trailing"'Observed log output:
plain line
undefined <-- was {"a":1}
undefined <-- was {}
[1,2]
trailingExpected: all five lines rendered verbatim.
The stored data is correct
swamp data get probe result --json shows stdout intact:
"stdout": "plain line\n{\"a\":1}\n{}\n[1,2]\ntrailing"So the defect is confined to how the method-run log renders stdout lines. It
looks like each line is being parsed/coerced and an object result is stringified
via a path that yields undefined.
Why this matters
This is not cosmetic — it fabricates output that looks real.
catof any YAML/JSON file lies. Runningcat some.yamlthroughcommand/shellrenderstags: {}astags: undefinedandinputs: {}asinputs: undefined. A reader reasonably concludes the file containsundefined, when it contains{}. Those are very different: one is an empty map, the other is a missing value.It causes real misdiagnosis. While debugging a datastore migration I
scp'd a shell script to a remote host and had it echo back its own config line. The echo rendered asundefined, so I concluded the file had been corrupted in transit and spent a cycle rewriting it to avoid quoting problems. Local and remote were in fact byte-identical (both 477 bytes) — the only thing wrong was the rendering. The genuine bug was elsewhere entirely.
Anything that prints structured config for inspection — cat, --json output
from another tool, a debug echo — is unreliable through this model, in a way the
reader cannot detect from the output itself.
Suggested fix
Render stdout lines as raw text. If per-line parsing is deliberate (e.g. to
pretty-print structured output), fall back to the original string whenever the
formatted result is undefined.
Environment
- swamp:
20260720.142822.0-sha.0caa5556 - model type:
command/shell2026.02.09.1 - OS: darwin (aarch64), also reproduced against a linux remote
Shipped
Click a lifecycle step above to view its details.