claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Invalid JSON Request: Malformed Input Causing API Parsing Error

Open dunktra opened this issue 1 year ago • 3 comments

Bug Description API Error: 400 {"type":"error", "error":{"type":"invalid_reques t_error","message":"The request body is not valid JSON: no low surrogate in string: line 1 column 307515 (char 307514)"},"request_id":"req_011 CSK1b5GFi8BwJDxoTKpcS"}. This error has disrupted my current workflow, stopped me in the middle of my task.

Environment Info

  • Platform: darwin
  • Terminal: cursor
  • Version: 1.0.70
  • Feedback ID: 709984a9-c792-4879-aa02-c2c2c92fd538

Errors

[{"error":"Error: Insufficient permissions for global npm install.\n    at Sq0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2032:1009)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async NG1 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2042:43)\n    at async file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:3222:10630","timestamp":"2025-08-19T16:36:34.506Z"},{"error":"Error: Insufficient permissions for global npm install.\n    at Sq0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2032:1009)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async NG1 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2042:43)\n    at async file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:3222:10630","timestamp":"2025-08-19T16:37:54.745Z"},{"error":"Error: Connection error.\n    at fP.makeRequest (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1243:4443)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async _w0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1259:6936)\n    at async SLB (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1524:401)\n    at async Object.call (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1519:976)\n    at async mM (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1881:929)\n    at async file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1936:7480\n    at async Promise.all (index 1)\n    at async gZ8 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1936:7225)\n    at async MX (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1936:4439)","timestamp":"2025-08-19T16:51:36.884Z"},{"error":"SyntaxError: Unexpected token 'I', \"I apologiz\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:738:9932\n    at Q (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:674:14418)\n    at E$B (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1259:10811)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-08-19T16:51:52.996Z"},{"error":"Error: Insufficient permissions for global npm install.\n    at Sq0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2032:1009)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async NG1 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2042:43)\n    at async file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:3222:10630","timestamp":"2025-08-19T16:56:03.002Z"},{"error":"Error: Insufficient permissions for global npm install.\n    at Sq0 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2032:1009)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async NG1 (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:2042:43)\n    at async file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:3222:10630","timestamp":"2025-08-19T16:59:40.013Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at $X (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:1184)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:2172\n    at Array.map (<anonymous>)\n    at $X (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:2143)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:2059\n    at Array.map (<anonymous>)\n    at $X (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:2048)\n    at file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:912\n    at Array.map (<anonymous>)\n    at qX (file:///usr/local/lib/node_modules/@anthropic-ai/claude-code/cli.js:1587:903)","timestamp":"2025-08-19T17:01:48.569Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at $X (file:///usr/local/lib/node_mod

Note: Error logs were truncated.

dunktra avatar Aug 20 '25 13:08 dunktra

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5934
  2. https://github.com/anthropics/claude-code/issues/1709
  3. https://github.com/anthropics/claude-code/issues/5917

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 20 '25 13:08 github-actions[bot]

Closing as duplicate

ollie-anthropic avatar Aug 20 '25 20:08 ollie-anthropic

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.

github-actions[bot] avatar Aug 28 '25 14:08 github-actions[bot]