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): add --app flag and actionable errors for non-interactive monorepo runs (#977)
Running `sentry init --yes --features errors` against a monorepo would
hit the `select-target-app` step, fail to resolve an app
non-interactively, and send `{ cancelled: true }` as resume data to the
server. The server validated it against a schema requiring `selectedApp`
and returned HTTP 500. Users saw:
```
WizardError: HTTP error! status: 500 - {"error":"Invalid resume data: \n- selectedApp: Required"}
```
Three root causes fixed here:
**1. No non-interactive escape hatch.** Added `--app <name>` flag so
CI/agent runs can specify which monorepo app to initialize.
Case-insensitive match against the server-provided app list.
**2. `handleSelect` returned instead of throwing.** When `--yes` was set
with multiple apps, it returned `{ cancelled: true }` which got
forwarded to the server as resume data. It now throws with a formatted
app list and the exact re-run command:
```
This monorepo has 3 apps. Use --app to specify which one to initialize:
sentry init --yes --features <features> --app web
Available apps:
web (Next.js) /repo/apps/web
api (Express) /repo/apps/api
admin (React) /repo/packages/admin
Or run without --yes to pick interactively:
sentry init
```
**3. Safety net.** Added a guard in `handleSuspendedStep` that throws
before any `{ cancelled: true }` result can reach `resumeWithRetry`, so
a future regression fails on the CLI side rather than producing an
opaque server error.
Also fixed the `default` branch in `handleInteractive` (same `{
cancelled: true }` bug for unknown prompt kinds) and rewrote
`formatAppList` to iterate over `items` rather than `apps` so the list
stays correct if `payload.options` and `payload.apps` ever arrive at
different lengths.
Closes CLI-17A (77 events, all `is_tty: False` + `flag.yes: True`).
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
0 commit comments