Invalid Message Submission: Whitespace-Only Text Rejection

Resolved 💬 1 comment Opened Mar 20, 2025 by pcannons Closed Mar 25, 2025

Bug Description
I accidentally hit space enter and got this error:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages: text content blocks must contain non-whitespace text"}}

Now my whole session is borked and I can't resume. Would be great to be able to /resume after a session fails for example because of something like this.

Environment Info

  • Platform: macos
  • Terminal: iTerm.app
  • Version: 0.2.52
  • Feedback ID: 2d456a3c-8f7f-436c-bc11-ca81a7864351

Errors

[{"error":"Error: spawn ENOTDIR\n    at ChildProcess.spawn (node:internal/child_process:421:11)\n    at spawn (node:child_process:753:9)\n    at execFile (node:child_process:346:17)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:431:1982\n    at new Promise (<anonymous>)\n    at D9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:431:1960)\n    at jg (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:431:3078)\n    at Object.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:431:3326)\n    at async Promise.all (index 4)\n    at async n1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:426:8505)","timestamp":"2025-03-20T22:56:44.944Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages: text content blocks must contain non-whitespace text\"}}\n    at d3.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:511:13514)\n    at q3.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:515:7207)\n    at q3.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:515:8149)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-20T22:56:48.579Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at eG (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:445:9965)\n    at kQ2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:586:672)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-20T22:56:48.586Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages: text content blocks must contain non-whitespace text\"}}\n    at d3.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:511:13514)\n    at q3.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:515:7207)\n    at q3.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:515:8149)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-20T22:56:48.627Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages: text content blocks must contain non-whitespace text\"}}\n    at d3.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:511:13514)\n    at q3.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:515:7207)\n    at q3.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:515:8149)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-03-20T22:56:50.427Z"}]

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗