Skip to content

fix(init): improve multi-org error message for agentic use#974

Merged
betegon merged 1 commit into
mainfrom
fix/multi-org-error-message
May 18, 2026
Merged

fix(init): improve multi-org error message for agentic use#974
betegon merged 1 commit into
mainfrom
fix/multi-org-error-message

Conversation

@betegon

@betegon betegon commented May 18, 2026

Copy link
Copy Markdown
Member

When --yes is set and the user has multiple orgs, the wizard currently hard-fails with:

Multiple organizations found (...). Set SENTRY_ORG to specify which one.

That's a dead-end for agents — they read stderr and retry, but the message doesn't tell them how to retry. This adds the positional syntax to the hint so agents can act on it immediately:

Multiple organizations found (bete-dev, sentry-eu, ...).
Specify one with: sentry init <org-slug>/ [directory]
  or set SENTRY_ORG=<org-slug>

All 7 occurrences in CLI-Z1 are the same user running sentry init via claude-code/cursor/codex with --yes and 8 orgs. No interactive users have hit this.

Test plan

  • Run sentry init --yes as a user with 2+ orgs and no existing Sentry config → see updated message
  • Run sentry init <org-slug>/ --yes → succeeds (unchanged)
  • Run SENTRY_ORG=<org-slug> sentry init --yes → succeeds (unchanged)

Fixes CLI-Z1

When --yes is set and multiple orgs are found, tell the user how to
specify one via the positional syntax (sentry init <org>/) in addition
to the SENTRY_ORG env var. Agents only see stderr so the actionable
hint needs to be in the message itself.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-974/

Built to branch gh-pages at 2026-05-18 16:01 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@betegon betegon marked this pull request as ready for review May 18, 2026 16:02
@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

6975 passed | Total: 6975 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

❌ Patch coverage is 0.00%. Project has 14092 uncovered lines.
✅ Project coverage is 77.13%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
src/lib/init/preflight.ts 0.00% ⚠️ 5 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    77.07%    77.13%    +0.06%
==========================================
  Files          320       320         —
  Lines        61664     61615       -49
  Branches         0         0         —
==========================================
+ Hits         47526     47523        -3
- Misses       14138     14092       -46
- Partials         0         0         —

Generated by Codecov Action

@betegon betegon merged commit 4d24755 into main May 18, 2026
28 checks passed
@betegon betegon deleted the fix/multi-org-error-message branch May 18, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant