You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(init): enrich 401 Unauthorized errors with actionable guidance
403 errors already get actionable hints via enrich403Detail() — telling
users to check token scopes or re-authenticate. 401 errors (invalid or
expired token) were falling through with the raw HTTP status text
("Failed to list organizations: 401 Unauthorized"), which gives no
indication of how to fix the problem.
Adds enrich401Detail() that mirrors the 403 pattern:
- env-var token path: directs to the token settings page
- OAuth path: tells the user to run sentry auth login
Also extends the resolveOrgSlug() catch in preflight.ts (which already
handled 403) to also catch 401 and surface the enriched detail via the
same { ok: false } return path — so the culprit in Sentry points to
ensureOrg rather than the generic withPreflightHandling catch.
Fixes: throwRawApiError's JSON-stringify fallback was not excluding 401
alongside 403, which would have produced noisy {"detail":null} prefixes
in the enriched message for 401 responses with non-string detail fields.
Also corrects a stale "sentry login" string (should be "sentry auth login")
in the empty-orgs fallback path.
Ref: CLI-1SD
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
0 commit comments