[BUG] Debug logging should capture retroactively, not require pre-enabling

Resolved 💬 1 comment Opened May 1, 2026 by Aeolun Closed Jun 1, 2026

Preflight Checklist

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

What's Wrong?

When hitting an intermittent error (in my case, a spurious API-level policy violation on Opus 4.7), there's no way to get debug logs after the fact. The /debug command only starts capturing from the moment it's invoked, and claude --debug requires launching the session in debug mode before the issue occurs. For unpredictable errors, neither option is useful — you can't know in advance that something will go wrong.

What Should Happen?

Claude Code should keep a rolling in-memory buffer of recent debug-level events. When /debug is invoked, it should flush that buffer to disk so the history leading up to the issue is available for investigation. This way users can invoke /debug after encountering a problem and still have the relevant context to report or diagnose it.

Error Messages/Logs

Steps to Reproduce

  1. Have unexpected error
  2. Enter /debug
  3. Have Claude complain you enabled /debug too late

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.123

Platform

Google Vertex AI

Operating System

macOS

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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