Skip to content

A 403 without a scope challenge still tells the agent to retry #2356

Open

Description

@sentry-junior

When Sentry answers 403 without an insufficient_scope challenge, the MCP still formats it with the generic Input Error template ("…You may be able to resolve the issue by addressing the concern and trying again.", packages/mcp-core/src/internal/error-handling.ts:349-360 on main, or the UserInputError branch when a tool rewraps it). #2222 fixed only the scope-challenge case and kept this one on purpose ("A role-based 403 has no challenge and keeps the old message").

These 403s come from the account's access, not from the input, so retrying the same call can't work:

  • Project access: an org-scoped endpoint called with project=<id> the caller's teams can't access raises a bare PermissionDenied (sentry src/sentry/api/bases/organization.py:475-490, _validate_fetched_projects, called from get_projects at :563-564). DRF's body is only "You do not have permission to perform this action." This is the search_issues shape: find_organizations and find_projects succeed, then the issue search for one project returns 403.
  • Lost org membership / role changes: same token, calls flip from 200 to 403.

Agents read "try again", retry once or twice, then give up without telling the user to ask an org Owner/Manager for access.

Reports (MCP user feedback, sentry/mcp-server): MCP-SERVER-GPB, MCP-SERVER-GPG, MCP-SERVER-GQJ, MCP-SERVER-GRH. Count: 4.

Proposed fix: a Permission Denied message for any non-scope ApiPermissionError (also when rewrapped as a cause) that says the account lacks access and retrying the same call won't help.

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_935b14afe7842382d29a911e0b9a1da2.

--

View Session [Sentry]

Activity

  1. linear-code commented on Nov 18, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions