claude-code - 💡(How to fix) Fix [BUG] claude plugin list --json --available truncates stdout at 65536 bytes when piped (process.exit before pipe drains)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Parsing the piped output:

Unterminated string starting at: line 1391 column 19 (char 65444)

As surfaced by the VS Code extension (anthropic.claude-code 2.1.157):

[error] Error processing client request: SyntaxError: Unterminated string in JSON at position 65478 (line 1391 column 53) [info] Received message from webview: {"type":"interrupt_claude","channelId":"r0g94scnvyk"} [warning] Channel not found: r0g94scnvyk

Code Example

# Parsing the piped output:
Unterminated string starting at: line 1391 column 19 (char 65444)

# As surfaced by the VS Code extension (anthropic.claude-code 2.1.157):
[error] Error processing client request: SyntaxError: Unterminated string in JSON at position 65478 (line 1391 column 53)
[info]  Received message from webview: {"type":"interrupt_claude","channelId":"r0g94scnvyk"}
[warning] Channel not found: r0g94scnvyk

---

$ claude plugin list --json --available | wc -c
   65536

---

$ claude plugin list --json --available | python3 -m json.tool >/dev/null
   Unterminated string starting at: line 1391 column 19 (char 65444)

---

$ claude plugin list --json --available > out.json; wc -c < out.json
   111710
   $ python3 -m json.tool < out.json >/dev/null   # no error; 204 plugins
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

claude plugin list --json --available truncates its JSON output to exactly 65536 bytes (64 KB) when stdout is a pipe, producing invalid, unterminated JSON. This is the classic Node.js bug of calling process.exit() before async writes to a pipe have drained — only what fits in the OS pipe buffer (64 KB on macOS) gets flushed before the process exits.

Anything that captures the CLI's stdout through a pipe hits this. In particular, the VS Code extension shells out via execFile (which captures stdout through a pipe) when opening the plugin browser, so the response fails to JSON.parse and the plugin marketplace UI is unusable for any user whose available-plugin metadata exceeds ~64 KB. (Here: 204 available plugins ≈ 111 KB.)

What Should Happen?

The command should emit complete, valid JSON regardless of whether stdout is a pipe, a TTY, or a file. The full payload should be flushed before the process exits.

Error Messages/Logs

# Parsing the piped output:
Unterminated string starting at: line 1391 column 19 (char 65444)

# As surfaced by the VS Code extension (anthropic.claude-code 2.1.157):
[error] Error processing client request: SyntaxError: Unterminated string in JSON at position 65478 (line 1391 column 53)
[info]  Received message from webview: {"type":"interrupt_claude","channelId":"r0g94scnvyk"}
[warning] Channel not found: r0g94scnvyk

Steps to Reproduce

Preconditions: configure enough plugin marketplaces that claude plugin list --json --available produces more than ~64 KB of JSON (in my case 204 available plugins, ~111 KB).

  1. Pipe the command and count the bytes — it's capped at exactly the 64 KB pipe buffer:

    $ claude plugin list --json --available | wc -c
    65536
  2. Confirm the piped output is invalid (truncated mid-string):

    $ claude plugin list --json --available | python3 -m json.tool >/dev/null
    Unterminated string starting at: line 1391 column 19 (char 65444)
  3. Redirect the SAME command to a regular file instead — now it's complete and valid:

    $ claude plugin list --json --available > out.json; wc -c < out.json
    111710
    $ python3 -m json.tool < out.json >/dev/null   # no error; 204 plugins

Pipe → truncated to 65536 bytes, invalid JSON. File → full 111710 bytes, valid JSON. The truncation offset is identical on every run, ruling out a timing/race condition and pointing at a fixed pipe-buffer flush boundary.

Likely fix: flush stdout fully before exiting — set process.exitCode and return instead of calling process.exit(), or process.stdout.write(json, () => process.exit(0)), or await a 'drain' event on backpressure.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.157

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal and VS Code extension

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] claude plugin list --json --available truncates stdout at 65536 bytes when piped (process.exit before pipe drains)