Claude Code · Debugging

Claude Code is stuck. Here's how to get it unstuck without starting over.

Two failure modes that Claude Code hits on longer tasks:

The loop. Same fix, same error, different approach to the same wrong place. Three iterations and it's still trying variations of something that fundamentally doesn't work.

The give-up. "I'm unable to solve this issue" or "This may require manual intervention." Claude stops and puts the problem back on you.

Both are recoverable without starting over.

Breaking the loop

The loop happens because Claude is pattern-matching against the error and trying plausible fixes. If none of the plausible fixes work, it cycles through them again with slight variations.

The way to break it: stop asking for fixes and ask for diagnosis instead.

Stop trying to fix this. Instead, explain:
1. What you think the root cause is
2. What you've already tried and why it didn't work
3. What information is missing that would tell you the actual cause

This forces Claude to reason about the problem rather than pattern-match against solutions. Often it names the actual root cause in step 1 that it had been routing around for three iterations.

Once you have the diagnosis, ask for one specific fix for the root cause — not "try to fix it."

Recovering from the give-up

When Claude says it can't solve something, it usually means one of three things:

Disambiguate with:

What specific information would you need to solve this?
What would you read or run to get it?

Usually it responds with something it can actually do — read a config file, run a specific command, check an import. The "I can't solve this" was actually "I don't have enough information." Those are different problems with different solutions.

The isolation move

When you can't break the loop, isolate the problem. Take the exact failing line/function and reproduce it in a minimal context:

Ignore the rest of the codebase for now.
Here is the isolated piece that's failing: [paste]
Here is the exact error: [paste]
What's wrong with this specific piece?

Removing the rest of the code removes the false leads. Claude stops looking for the problem in the wrong place because the wrong place isn't in context anymore.

The context reset trick

If a task has been going for a long time and Claude is stuck late in the session, context pressure might be affecting its reasoning. Long sessions accumulate wrong turns, abandoned approaches, and contradictory states that make the problem look harder than it is.

Write the current state to a file (what's failing, what's been tried, what the actual goal is), then start a new session and read only that file. Fresh context often resolves problems that were stuck for multiple iterations.

More debugging workflows like these are in the Agent Prompt Playbook. $29.