Skip to content

fix(cli): Point org auth token 401s at the org's auth token settings - #2167

Merged
betegon merged 2 commits into
mainfrom
fix/cli-org-token-401-hint
Nov 11, 2026
Merged

betegon merged 2 commits into
mainfrom
fix/cli-org-token-401-hint

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2165.

Split out of #2160.

About 1% of release create and sourcemap upload runs hit a 401: over 14 days, about 75k and 59k on 0.45 (about 100 each on 0.49). Most CI setups use org auth tokens, but the 401 message sends every env token to the personal token page.

Before

release create, with an org auth token (sntrys_…) in SENTRY_AUTH_TOKEN:

Error: Failed to create release: 401 Unauthorized
  Invalid org token

  Your SENTRY_AUTH_TOKEN token is not recognized or has been revoked.
  Create a new token at: <sentry-url>/settings/account/api/auth-tokens/

After

Error: Failed to create release: 401 Unauthorized
  Invalid org token

  Your SENTRY_AUTH_TOKEN org auth token is not recognized or has been revoked.
  Create a new one in your organization's Settings > Auth Tokens.

On Token expired, the third line reads Your SENTRY_AUTH_TOKEN org auth token has expired. instead. A stored sntrys_… token reads Your stored org auth token …. A sentry auth login session with a leftover SENTRY_AUTH_TOKEN now gets Re-authenticate with: sentry auth login instead of advice about the env token.

via @betegon.

--

View Session in Sentry

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 11, 2026 6:47pm UTC

Request Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e334945. Configure here.

@sentry-junior
sentry-junior Bot force-pushed the fix/cli-org-token-401-hint branch from cb6ad61 to c14449e Compare November 11, 2026 09:13
@sentry-junior
sentry-junior Bot force-pushed the fix/cli-org-token-401-hint branch from c14449e to ecb1c21 Compare November 11, 2026 09:24
@betegon
betegon force-pushed the fix/cli-org-token-401-hint branch from ecb1c21 to b5fbdc7 Compare November 11, 2026 10:08
@sentry-junior
sentry-junior Bot force-pushed the fix/cli-org-token-401-hint branch from b5fbdc7 to 34f7b95 Compare November 11, 2026 11:26
Base automatically changed from fix/cli-scope-challenge-hint to main November 11, 2026 11:29
An unknown or expired org auth token was told to create a new personal
token. Send org auth tokens (from an env var or stored, classified by the
`sntrys_` prefix as Sentry does) to the organization's Settings > Auth
Tokens instead. Base the advice on the credential the request sent, so a
stored login with a leftover env token gets re-login steps rather than
env-token advice.

Co-Authored-By: bete <[email protected]>
@betegon
betegon force-pushed the fix/cli-org-token-401-hint branch from 34f7b95 to 1cdc75c Compare November 11, 2026 11:29
One row per credential: an unrecognized org auth token points at the
org's Settings > Auth Tokens, and a stored login with a leftover env
token gets re-auth advice.

Co-Authored-By: bete <[email protected]>
@betegon
betegon merged commit 92ec3b3 into main Nov 11, 2026
26 checks passed
@betegon
betegon deleted the fix/cli-org-token-401-hint branch November 11, 2026 19:45

This branch was previously deployed

1 inactive deployment
Preview — 5cb83b97 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant