-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
[Bug]: --json mode CLI stdout is polluted by plugin/bootstrap logs, breaking machine-readable output #37323
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
Commands invoked with --json can emit plugin/bootstrap logs to stdout before the JSON payload, which breaks machine-readable CLI output and causes direct jq parsing to fail.
Steps to reproduce
- Use a setup where plugins are enabled and initialize during CLI startup.
- Run:
openclaw plugins list --json | jq .
- Run:
openclaw hooks list --json | jq .
- Observe that stdout may contain plugin/bootstrap log lines before the JSON payload.
Expected behavior
When a command is invoked with --json, stdout should contain only JSON. Non-fatal logs/warnings should go to stderr or be suppressed in JSON mode. Human text mode should remain unchanged.
Actual behavior
Commands that should be machine-readable can print startup/plugin log lines such as plugin registration / hook runner initialization before the JSON payload on stdout. This causes jq and other automation consumers to fail because stdout is no longer pure JSON.
OpenClaw version
2026.3.2 (85377a2)
Operating system
Linux 6.17.4-2-pve (x64) in LXC
Install method
npm global / CLI install
Logs, screenshots, and evidence
$ openclaw plugins list --json | jq .
[plugins] [email protected]: plugin registered (db: /usr/local/lib/openclaw-memory/lancedb-pro, model: gemini-embedding-001)
[plugins] self-improvement: integrated hooks registered (agent:bootstrap, command:new, command:reset)
[plugins] memory-reflection: integrated hooks registered (command:new, command:reset, after_tool_call, before_agent_start, before_prompt_build)
[plugins] hook runner initialized with 5 registered hooks
parse error: Invalid numeric literal at line 1, column 9The same class of contamination was observed around other JSON-mode CLI startup paths because plugin/bootstrap logging happens early in startup.
Impact and severity
Affected: CLI users relying on --json for automation, scripting, and CI
Severity: Medium to High (breaks machine-readable contract for affected commands)
Frequency: Reproducible when plugin/bootstrap logs are emitted on startup
Consequence: JSON consumers fail, automation becomes brittle, and users must rely on wrappers or log-level workarounds instead of a stable JSON stdout contract
Additional information
This appears to be a core CLI/logging issue rather than a plugin-specific data bug. The expected fix direction is to ensure that when JSON mode is active, subsystem/plugin bootstrap logs are routed to stderr (or suppressed) while stdout remains reserved for JSON payloads only.