Invalid Message Content in API Request

Resolved 💬 4 comments Opened Jun 27, 2025 by Bad3r Closed Aug 20, 2025

Bug Description
I am getting this error even though I am sending a message. This error is unfixable unless you restart claude Code.

- API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5: all 
-    messages must have non-empty content except for the optional final assistant message"}}

Environment Info

  • Platform: linux
  • Terminal: kitty
  • Version: 1.0.35
  • Feedback ID: aee8e588-6502-4d8a-a7e2-e60cb35aaa58

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5: all messages must have non-empty content except for the optional final assistant message\"}}\n    at Z5.generate (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1299:12578)\n    at Jq.makeStatusError (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1314:2100)\n    at Jq.makeRequest (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1314:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async V$2.l11.showErrors (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:22790)\n    at async l11 (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:12370)\n    at async V$2 (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:22636)\n    at async file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:17760\n    at async M1A (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:5121)\n    at async Mu (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:17730)","timestamp":"2025-06-27T12:59:29.480Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5: all messages must have non-empty content except for the optional final assistant message\"}}\n    at Z5.generate (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1299:12578)\n    at Jq.makeStatusError (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1314:2100)\n    at Jq.makeRequest (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1314:5311)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async V$2.l11.showErrors (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:22790)\n    at async l11 (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:12370)\n    at async V$2 (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:22636)\n    at async file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:17760\n    at async M1A (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:5121)\n    at async Mu (file:///home/odd/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1680:17730)","timestamp":"2025-06-27T13:01:58.878Z"}]

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗