[BUG] `plugins list --json` produces invalid output
Status Fixed / completed
Reported on v2.1.143
Maintainer reply None cached
Activity 3 comments · opened May 18, 2026 · closed May 20, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When I run claude plugins list --json (or claude plugin list --json for SEO) the output isn't valid JSON as it contains various non-printable characters.
What Should Happen?
The output of this command should be valid JSON.
Error Messages/Logs
^[7^[[r^[8^[[?25h[^M^M$
^[[2C{^M^M$
^[[4C"id":^[[1C"foobar@my-plugins",^M^M$
Steps to Reproduce
Run claude plugins list --json (or claude plugin list --json).
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.143 (Claude Code)
Platform
Other
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Root Cause Analysis & Fix Proposal
Root Cause: TUI Output Mixed into CLI JSON Output
The
claude plugins list --jsonoutput contains ANSI escape sequences, making the output invalid JSON:ANSI escape sequence breakdown:
^[7/^[8— DECSC/DECRC (save/restore cursor position)^[[r— Set scroll region^[[?25h— Show cursor^[[2C/^[[4C— Cursor forward 2/4 columns^M— Carriage return (CR)Root cause: The
plugins list --jsoncommand still has the TUI component active when outputting JSON. TUI cursor control sequences are mixed into stdout. The JSON serializer may also be executing within the TUI rendering pipeline.Fix Proposal
Option A: Early exit for JSON mode (recommended, ~20 LoC)
Add an early return path in the plugins list command handler:
Option B: Suppress TUI output when --json flag is set (~30 LoC)
Add a global flag to suppress TUI rendering:
Option C: Pipe JSON through a clean writer (~15 LoC)
Deliverables
| Deliverable | Description |
|-------------|-------------|
| Root cause analysis | TUI/CLI output pipe mixing analysis |
| Fix patch | Option A code patch |
| Test case | Verify
--jsonproduces valid JSON || Regression test | Verify non-JSON mode still works |
Estimated Effort
Cross-sell Opportunity
Bundle with other claude-code CLI issues:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.