{"record":{"id":"ab663f1ffa8c84b7","repo":"thedotmack/claude-mem","slug":"subscription-usage-limit-hit","errorCode":null,"errorMessage":"Subscription usage limit hit","messagePattern":"Subscription usage limit hit","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/services/worker/ClaudeProvider.ts","lineNumber":339,"sourceCode":"      let turnDispatchedText = false;\n      // One re-queue per generator pass for a batch a failed turn never read.\n      let retriedAfterErrorResult = false;\n\n      for await (const message of queryResult) {\n        // Quota-aware wall-clock guard (#2234): the SDK pushes\n        // `rate_limit_event` messages carrying live subscription quota state\n        // (see extractRateLimitInfo for the shape). Capture the snapshot, then\n        // bail out of the loop before issuing another request if we've\n        // crossed a per-window threshold. API-key users are exempt — they\n        // authorized per-call spend.\n        const info = extractRateLimitInfo(message);\n        if (info) {\n          // The observer runs on the same account as the observed session,\n          // so a `rejected` snapshot here means the user's own Claude Code\n          // session is out of usage too. set() dedupes: one event per\n          // exhausted window, not one per observer request against the wall.\n          if (globalRateLimitStore.set(info)) {\n            logger.warn('SDK', 'Subscription usage limit hit', {\n              sessionDbId: session.sessionDbId,\n              window: info.rateLimitType,\n              overageStatus: info.overageStatus,\n            });\n            captureEvent('usage_limit_hit', {\n              ...buildUsageLimitHitProps(info),\n              ide: session.platformSource,\n              provider: 'claude',\n              observed_model: session.observedModel,\n              observed_billing: session.observedBilling,\n            });\n          }\n          const decision = shouldAbortForQuota(authMethod, globalRateLimitStore);\n          if (decision.abort) {\n            logger.warn('SDK', `Aborting session for quota guard: ${decision.reason}`, {\n              sessionDbId: session.sessionDbId,\n              window: decision.window,\n              authMethod,","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/services/worker/ClaudeProvider.ts#L321-L357","documentation":"This is a warning log emitted when the SDK observer detects that the Claude subscription usage limit has been hit for the account running the session. The observer runs on the same account as the observed session, and globalRateLimitStore.set() dedupes so only one event is recorded per exhausted window rather than one per observer request. It signals that the user's own Claude Code session is out of usage until the rate-limit window resets.","triggerScenarios":"During startSession, when an observer SDK request returns a rate-limit info snapshot with rateLimitType 'rejected' status, indicating the shared account's subscription usage wall is exhausted for the current window.","commonSituations":"Hitting the 5-hour or weekly Claude subscription cap during heavy automated usage; multiple observed sessions sharing one account exhausting the quota; overage disabled so requests are rejected outright.","solutions":["Wait for the rate-limit window to reset, or upgrade the subscription plan/increase limits.","Enable or verify overage billing (overageStatus) so requests continue past the soft cap.","Reduce the number of concurrent observed sessions sharing the same account.","Route work to a different account or API-key-based billing until the window resets."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (globalRateLimitStore.peek?.()?.rateLimitType === 'rejected') {\n  // defer session start until the window resets\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the usage-limit store before starting new sessions","Enable overage or use API billing for unattended automation","Spread work across accounts/windows"],"tags":["rate-limit","usage-quota","subscription"],"backgroundTag":"rate-limit-exceeded","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}