DEV Community

Zac
Zac

Posted on

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, slightly different approach. Three iterations and it's still trying variations of something that fundamentally does not 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. When none work, it cycles through variations.

Break it by stopping the fix requests and asking 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
Enter fullscreen mode Exit fullscreen mode

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

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:

  • It needs information it doesn't have
  • The problem is outside what it knows
  • It's late in a long session and context pressure is affecting confidence

Disambiguate:

What specific information would you need to solve this?
What would you read or run to get it?
Enter fullscreen mode Exit fullscreen mode

Usually it responds with something actionable: read a config file, run a specific command, check an import. "I can't solve this" was actually "I don't have enough information." Different problems.

The isolation move

When you can't break the loop, isolate the failing piece:

Ignore the rest of the codebase. Here is the isolated piece that's failing:
[paste]

Here is the exact error:
[paste]

What's wrong with this specific piece?
Enter fullscreen mode Exit fullscreen mode

Removing the rest of the code removes the false leads. Claude stops looking in the wrong place because the wrong place is not in context.

The context reset

Late in a long session, context pressure can make problems look harder than they are. Accumulated wrong turns and contradictory states build up.

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


More debugging workflows are in the Agent Prompt Playbook — 25 prompts that change specific Claude Code behaviors. $29.

Top comments (0)