thedotmack/claude-mem · warning

Aborting session for quota guard

Error message

Aborting session for quota guard: ${decision.reason}

What it means

This warning is logged when the quota guard (shouldAbortForQuota) decides a session must be aborted because the account's usage window is exhausted for the current auth method. The session is marked with abortReason `quota:<window>` and terminated. It is the enforcement action following the usage-limit detection in the same observer flow.

Solutions

  1. Wait for the quota window to reset before restarting the session.
  2. Upgrade the plan or enable overage so the guard no longer aborts.
  3. Switch to an auth method that the quota guard permits (e.g. API billing instead of subscription) once available.
  4. Check decision.window to know which window (e.g. five_hour vs weekly) must clear.

Example fix

// before
session.abortReason = `quota:${decision.window ?? 'unknown'}`;
// after (defer start until window resets)
if (decision.abort) {
  scheduleRetryAtWindowReset(session, decision.window);
  return;
}
session.abortReason = `quota:${decision.window ?? 'unknown'}`;
Defensive patterns

Strategy: retry

Validate before calling

const decision = shouldAbortForQuota(authMethod, globalRateLimitStore);
if (decision.abort) scheduleRestartAtWindowReset(decision.window);

Try / catch

try {
  await provider.startSession(session);
} catch (e) {
  if (String(e).includes('quota:')) retryAtWindowReset(session);
  else throw e;
}

Prevention

When it happens

Trigger: startSession observes a rejected rate-limit snapshot and shouldAbortForQuota(authMethod, globalRateLimitStore) returns decision.abort=true, meaning the auth method does not bypass quota and the store shows the window is exhausted.

Common situations: Subscription plan exhausted with overage disabled; using an auth method that has no quota exemption while the shared rate-limit store is tripped; starting new sessions while an existing limit window is active.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/9616393730cab120. Report an issue: GitHub.

Appendix: source

Thrown at src/services/worker/ClaudeProvider.ts:354

          // session is out of usage too. set() dedupes: one event per
          // exhausted window, not one per observer request against the wall.
          if (globalRateLimitStore.set(info)) {
            logger.warn('SDK', 'Subscription usage limit hit', {
              sessionDbId: session.sessionDbId,
              window: info.rateLimitType,
              overageStatus: info.overageStatus,
            });
            captureEvent('usage_limit_hit', {
              ...buildUsageLimitHitProps(info),
              ide: session.platformSource,
              provider: 'claude',
              observed_model: session.observedModel,
              observed_billing: session.observedBilling,
            });
          }
          const decision = shouldAbortForQuota(authMethod, globalRateLimitStore);
          if (decision.abort) {
            logger.warn('SDK', `Aborting session for quota guard: ${decision.reason}`, {
              sessionDbId: session.sessionDbId,
              window: decision.window,
              authMethod,
            });
            session.abortReason = `quota:${decision.window ?? 'unknown'}`;
            try {
              session.abortController.abort();
            } catch {
              // best-effort
            }
            break;
          }
        }

        if (message.session_id && message.session_id !== session.memorySessionId) {
          const previousId = session.memorySessionId;
          session.memorySessionId = message.session_id;
          const registeredId = this.dbManager.getSessionStore().ensureMemorySessionIdRegistered(

View on GitHub (pinned to d8bc9755e7)