Regression: File Write Protection Not Re-Enabled After /compact Command

Resolved 💬 2 comments Opened Apr 1, 2025 by mrjoshuak Closed Apr 2, 2025

Bug Description
Guards against writing to unread files are not re-enabled by /compact, but /compact by definition removes read file content from the chat context. This is a rather serious bug.

Environment Info

  • Platform: macos
  • Terminal: iTerm.app
  • Version: 0.2.57
  • Feedback ID: 3a56bc23-fee2-48ff-b912-231740c866ee

Errors

[{"error":"Error: Request was aborted.\n    at Om._createMessage (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:24058)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-04-01T04:27:49.437Z"},{"error":"SyntaxError: Unexpected token 'I', \"I apologiz\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at nI (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:558:9969)\n    at Y$2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1447:672)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-04-01T04:28:06.502Z"},{"error":"Error: Request was aborted.\n    at $6.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:7692)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-04-01T04:28:15.549Z"},{"error":"Error: File content (26963 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n    at Fg5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1619:2307)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1619:1384)\n    at async Zj5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:4719)\n    at async K31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:3293)\n    at async _N2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:511)\n    at async Ij5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2640)\n    at async ES1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2471)\n    at async Ch (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:1944)\n    at async R2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3696:14004)","timestamp":"2025-04-01T04:46:01.437Z"},{"error":"Error: Warning: The file exists and was read successfully. The contents of the file are empty.\n    at Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1619:1223)\n    at call.next (<anonymous>)\n    at Zj5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:4719)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async K31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:3293)\n    at async _N2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:511)\n    at async Ij5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2640)\n    at async ES1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2471)\n    at async Ch (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:1944)\n    at async Ch (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2318)","timestamp":"2025-04-01T04:46:13.233Z"},{"error":"Error: Warning: The file exists and was read successfully. The contents of the file are empty.\n    at Object.call (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1619:1223)\n    at call.next (<anonymous>)\n    at Zj5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:4719)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async K31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:3293)\n    at async _N2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:511)\n    at async Ij5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2640)\n    at async ES1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2471)\n    at async Ch (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:1944)\n    at async Ch (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2318)","timestamp":"2025-04-01T04:46:15.218Z"},{"error":"Error: File content (26963 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n    at Fg5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1619:230

Note: Error logs were truncated.

View original on GitHub ↗

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