claude-code - 💡(How to fix) Fix [CCR Beta] Routine sessions stuck in infinite loop after API error — Esc key does not stop execution

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

CCR (Claude Code Routines) sessions enter an infinite restart loop when an API error occurs mid-execution. The session infrastructure automatically resumes ("Sessão retomada") after each error, preventing the session from ever terminating. Pressing Esc has no effect.

Error Message

  • Session UI shows repeated "Sessão retomada" (Session resumed) entries
  • Each resumption triggers a new API error: An error occurred while executing Claude Code. You can try again by sending a new message or starting a new session.
  • A "Limite de uso se aproximando" (Usage limit approaching) warning appears — stuck sessions are consuming usage quota
  • No UI mechanism stops the loop (Esc, page refresh, "Tentar novamente" all ineffective)
  • Latest iteration is now spinning up a new cloud container from scratch on each loop, amplifying resource consumption

Root Cause

CCR (Claude Code Routines) sessions enter an infinite restart loop when an API error occurs mid-execution. The session infrastructure automatically resumes ("Sessão retomada") after each error, preventing the session from ever terminating. Pressing Esc has no effect.

Fix Action

Fix / Workaround

Workaround (partial)

RAW_BUFFERClick to expand / collapse

Summary

CCR (Claude Code Routines) sessions enter an infinite restart loop when an API error occurs mid-execution. The session infrastructure automatically resumes ("Sessão retomada") after each error, preventing the session from ever terminating. Pressing Esc has no effect.

Environment

  • Platform: Claude Code Web (claude.ai/code)
  • Feature: Routines (CCR) — Beta
  • Trigger ID: trig_01J8RVqbMUbqcAe5e75uJXEw
  • Routine name: sre-skill-telemetry-update
  • Schedule: Daily at 8:30 AM GMT-3

Affected sessions

SessionTriggered byStatusStuck since
session_017a9vyC9kj13sMHgMLnoz9DMANUALEm execuçãoMay 22 at 4:40 PM GMT-3
(hoje às 8:38 AM)PROGRAMADOEm execuçãoMay 25 at 8:38 AM GMT-3
(hoje às 10:33 AM)MANUALEm execuçãoMay 25 at 10:33 AM GMT-3

Steps to reproduce

  1. Create a CCR routine that uses ScheduleWakeup internally (e.g. a /loop-based skill)
  2. Trigger an execution (manual or scheduled)
  3. When an API error occurs mid-session, the CCR infrastructure automatically resumes the session
  4. The resumed session hits another API error → resumes again → infinite loop
  5. Pressing Esc inside the stuck session has no effect
  6. The session remains in "Em execução" (In Execution) status indefinitely

Observed behavior

  • Session UI shows repeated "Sessão retomada" (Session resumed) entries
  • Each resumption triggers a new API error: An error occurred while executing Claude Code. You can try again by sending a new message or starting a new session.
  • A "Limite de uso se aproximando" (Usage limit approaching) warning appears — stuck sessions are consuming usage quota
  • No UI mechanism stops the loop (Esc, page refresh, "Tentar novamente" all ineffective)
  • Latest iteration is now spinning up a new cloud container from scratch on each loop, amplifying resource consumption

Expected behavior

  • Sessions should NOT auto-resume after an API error without explicit user confirmation
  • Esc should reliably interrupt an in-progress CCR session
  • There should be an explicit "Stop/Cancel execution" button per session in the Routines UI
  • Usage quota consumed by stuck/looping sessions should not count against the user's limit

Impact

  • 3 sessions stuck simultaneously for the same trigger (oldest: 3+ days)
  • Usage quota being actively drained by non-productive loops
  • No user-accessible way to terminate stuck sessions
  • Container provisioning on each iteration suggests significant infrastructure waste

Workaround (partial)

Pausing the trigger (enabled: false via API) prevents new executions from being scheduled, but does not terminate already-running sessions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Sessions should NOT auto-resume after an API error without explicit user confirmation
  • Esc should reliably interrupt an in-progress CCR session
  • There should be an explicit "Stop/Cancel execution" button per session in the Routines UI
  • Usage quota consumed by stuck/looping sessions should not count against the user's limit

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING