#22966: fix(onboard): error on unknown --auth-choice in non-interactive mode
commands
size: XS
Cluster:
Device Auth and Security Fixes
## Summary
- Adds an explicit error message and `exit(1)` when an unrecognized `--auth-choice` value is passed to `openclaw onboard --non-interactive`
- Previously, unknown values silently fell through and returned the config unchanged — no auth was configured and no error was shown
This addresses part 2 of #17191 (unknown auth choices silently skipped). Part 1 (`apiKey` ignoring `--token-provider`) is a separate, larger change.
Fixes #17191
## Local Validation
- [x] Error message includes the invalid value and help hint
- [x] All known auth choices are handled before the new fallback
## Scope
XS — 3-line change in one file
## AI Assistance
Used Claude Code for issue investigation and fix implementation.
## Author
@miloudbelarebia
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Replaced silent fallthrough with explicit error for unknown `--auth-choice` values in non-interactive mode. Previously, unrecognized auth choices returned the config unchanged without any auth configured and no error shown.
**Critical Issue Found:**
- The `"skip"` auth choice (valid and used as default in `local.ts:53`) will now trigger an error instead of being allowed to pass through
- This breaks the default behavior when no auth choice is specified
**Other Observations:**
- Several valid auth choices (`github-copilot`, `copilot-proxy`, `google-antigravity`, `google-gemini-cli`) are not explicitly handled, but these likely require interactive mode anyway
- The error message format is helpful and consistent with other errors in the function
<h3>Confidence Score: 1/5</h3>
- This PR contains a critical bug that breaks the default auth flow
- The change introduces a logic error that causes `authChoice === "skip"` to error out, breaking the default behavior when no auth choice is specified (as "skip" is used as the fallback value in local.ts:53)
- src/commands/onboard-non-interactive/local/auth-choice.ts requires immediate attention to handle the "skip" case
<sub>Last reviewed commit: e517647</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16388: Fix: Show model selector during onboarding for all auth choices
by saurav470 · 2026-02-14
72.4%
#6400: fix: set correct mode for Anthropic OAuth auth (#2697)
by coupclawbot · 2026-02-01
70.2%
#7813: feat(onboard): validate Venice API keys during setup
by jonisjongithub · 2026-02-03
69.3%
#17605: fix: preserve scopes when disableControlUiDeviceAuth is enabled
by MisterGuy420 · 2026-02-16
69.2%
#22658: Fix onboard ignoring OPENCLAW_GATEWAY_TOKEN env var
by Clawborn · 2026-02-21
69.2%
#16626: fix: prompt onboarding auth selection when auth choice is blank
by harshang03 · 2026-02-14
69.1%
#16033: fix: add model configuration step to onboard command
by MisterGuy420 · 2026-02-14
68.7%
#3591: CLI: add OpenAI-compatible endpoint auth choice
by surak · 2026-01-28
68.4%
#21934: fix #21914 - Add the most obvious option to the error message
by vivganes · 2026-02-20
68.0%
#17572: fix: make dangerouslyDisableDeviceAuth bypass device identity checks
by gitwithuli · 2026-02-15
67.7%