Skip to content

[Bug]: Cursor weekly usage limit is misclassified as a generic provider/SDK error #45739

Backlog

Description

@smirea

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

This reproduces deterministically offline with no Cursor account using a local HTTP/1.1 ConnectRPC stub backend:

  1. Start a local HTTP/1.1 server on http://127.0.0.1:13998 that answers:
    • GET /v1/me -> {"apiKeyName":"stub","createdAt":"2026-01-01T00:00:00.000Z","userEmail":"stub@example.invalid"}
    • GET /v1/models -> {"items":[{"id":"default","displayName":"Auto"}]}
    • POST /auth/exchange_user_api_key -> {"accessToken":"stub-access-token"}
    • POST /agent.v1.AgentService/RunSSE -> HTTP 200 (content-type: application/connect+proto) with a Connect EndStreamResponse (0x02 frame) whose JSON error has code: "resource_exhausted" and details: [{ type: "aiserver.v1.ErrorDetails", value: <base64 protobuf for error = PRO_USER_USAGE_LIMIT (10), title = "Weekly usage limit reached.", detail = "It resets in 3 days. Buy credits to keep going now."> }].
  2. Start T3 Code with CURSOR_BACKEND_URL=http://127.0.0.1:13998 CURSOR_API_KEY=test-cursor-key.
  3. Enable the cursor provider and set text generation to cursor / default.
  4. Start a Cursor thread with any prompt (for example, Say hello) and open it in the web app.
  5. Open the thread actions menu and click Regenerate title.

Expected behavior

Per docs/internals/03_providers.md ("Classify quota/rate-limit errors as usage_limit (with reset time when available) rather than generic failures"), PR #26234, and PR #29748:

  1. The failed Cursor turn should be classified as usage_limit, showing the Usage limit reached banner and the sidebar Limited badge.
  2. Text generation (thread title, branch name, commit message, PR text) should report "Cursor usage limit reached. Try again later or choose another text-generation provider.".

Actual behavior

  1. The Cursor turn is classified as provider_error, displaying a red Provider error in the conversation timeline with no Limited badge or usage-limit recovery banner.
  2. Clicking Regenerate title shows a toast with the generic fallback "Cursor SDK request finished with an error.".

Root cause: In @cursor/sdk@1.5.2, AgentClient wraps the ConnectError carrying aiserver.v1.ErrorDetails (PRO_USER_USAGE_LIMIT) into an internal ActionRequiredError (cause: ConnectError, no .code), and LocalAgent's toRunError/wrapError only inspects instanceof CursorSdkError and instanceof ConnectError (not .cause), so RunResult.error arrives with { message: "Weekly usage limit reached. It resets in 3 days. Buy credits to keep going now." } and code: undefined — which isCursorUsageLimitError() in packages/provider-cursor/src/server/CursorAgentSdk.ts does not recognize.

Impact

Major degradation or frequent failure

Version or commit

v0.1.14-nightly.20261129.5452 / main @ df2cbe3961

Environment

macOS (arm64), Node v26.13.1, Chromium 156, @cursor/sdk@1.5.2, Cursor provider (default model). Reproduces identically on Linux with the local ConnectRPC stub above.

Logs or stack traces

RunResult from @cursor/sdk@1.5.2:
{
  "status": "error",
  "error": {
    "message": "Weekly usage limit reached. It resets in 3 days. Buy credits to keep going now."
  }
}
// result.error.code === undefined
// isCursorUsageLimitError(result.error) === false

Screenshots, recordings, or supporting files

Cursor weekly usage limit misclassified as Provider error and generic text-generation failure

Workaround

Switch the text-generation provider in Settings to another provider and manually retry Cursor turns after the limit resets or credits are purchased.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions