vibeblame

Claude Code ECONNRESET and a stuck /compact

Claude Code returns ECONNRESET and /compact hangs? Check whether the error follows one session, save your work, and try earlier auto-compaction.

If a long Claude Code session returns ECONNRESET and /compact hangs, try a short request in a fresh session on the same model and connection. If the fresh session responds, save what you can from the old one and continue with a small handoff. If the fresh session fails too, check the service and connection first. ECONNRESET describes a dropped connection. The message alone doesn’t identify where it dropped. Claude Code troubleshooting

Check whether the failure follows the old conversation

  1. Keep the affected session open. If the client is responsive, stop the hanging turn and note the exact message.
  2. In a second terminal, start claude from the same project. Use the same model and authentication method, then send one short prompt without pasting logs or attachments.
  3. Compare the results and write down the time. If both sessions fail, check Claude Status and the proxy or network settings for your connection. A newly started Claude Code session can also fail for authentication or quota reasons. Check the message it actually returns. Claude Code proxy and certificate settings · How to identify a plan usage limit

In a November 12 GitHub report on Windows, normal requests worked in sessions around 191K tokens or less, while reported failures occurred at 254K or more. Manual compaction also hung in one smaller session. The report covered Claude Code 2.1.321 in Claude Desktop and 2.1.322 in a desktop wrapper. Treat those numbers as observations from that setup. Your client, model, and context can produce different results. Claude Code issue #109170

Save your work and continue in a fresh session

  1. Review the files already changed. For a Git project, use git status --short, then inspect the diff and any untracked files.
  2. If the original client still accepts commands and supports export, use /export claude-session.txt to save the conversation locally. You can also copy the decisions and relevant messages directly. Claude Code command reference
  3. Give the new session the goal, decisions already made, files changed, and the next test. Attach only the excerpt it needs. Loading the entire old transcript can quickly consume the new context window.

For example, you could start with “Continue the export bug fix. The serializer change is already on disk. Review the diff first. The remaining test is the empty-list case.” Keep the old session if you want to return to it through /resume. Resuming or forking gives access to the old history, so a fresh session with a handoff is the more direct test when that history appears to trigger the error. Claude Code session commands

How to compact earlier in future sessions

When a session still responds, use /context to check how much is loaded. You can ask /compact to keep the plan, changed files, and remaining checks. If large tool output refills the window after compaction, reduce what you bring into the next turn. Claude Code’s compaction troubleshooting

Claude Code also documents an optional auto-compaction window. The issue reporter used 150,000 tokens for later sessions. If you want to try the same experiment, add the variable to the existing env object in your Claude Code settings and open a fresh session. Merge the value with your existing settings.

{
  "env": {
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "150000"
  }
}

This setting changes when automatic compaction starts. It’s most useful in sessions that can still compact successfully. The reported value is an example from one setup. Claude Code environment variables · Reported workaround

Frequently asked questions

Will /compact fix a session that already fails on every request?

It may fail too, as the November report shows. If a fresh session works and the old one repeatedly disconnects, use the fresh session to finish the job and keep the old history for reference.

What should I include in a bug report?

Record the version, model, client, operating system, timestamps with time zone, approximate context size, and results in the fresh and affected sessions. Review any log excerpt for credentials and private project data before sharing it.

Claude Code ECONNRESET and Stuck /compact — What to Do