Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

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]
trailing

Expected: 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.

  1. cat of any YAML/JSON file lies. Running cat some.yaml through command/shell renders tags: {} as tags: undefined and inputs: {} as inputs: undefined. A reader reasonably concludes the file contains undefined, when it contains {}. Those are very different: one is an empty map, the other is a missing value.

  2. 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 as undefined, 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/shell 2026.02.09.1
  • OS: darwin (aarch64), also reproduced against a linux remote
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 5 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

7/20/2026, 11:56:34 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/20/2026, 9:49:22 PM
Editable. Press Enter to edit.

stack72 commented 7/20/2026, 11:56:42 PM

Thanks @magistr for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.