important-diamond-63626
01/02/2026, 1:30 PMInvalidSelectValueError: Illegal select value 'cerebras/zai-glm-4.6'.limited-student-10747
01/02/2026, 2:03 PMnutritious-balloon-65098
01/02/2026, 2:03 PMnutritious-balloon-65098
01/02/2026, 2:10 PMInvalidSelectValueError: Illegal select value 'cerebras/zai-glm-4.6' bug in the OpenHands CLI.
Root Cause Analysis
The bug occurs in settings_screen.py when loading existing settings in basic mode:
1. How models are stored: The full model string with provider prefix (e.g., cerebras/zai-glm-4.6) is stored in the settings
2. How dropdown options are populated: The get_model_options() function returns model IDs WITHOUT the provider prefix (e.g., zai-glm-4.6)
3. The bug: When loading settings, the code was setting self.model_select.value = llm.model (the full string cerebras/zai-glm-4.6), but the dropdown only contains zai-glm-4.6 as a valid option
This caused Textual's Select widget to throw InvalidSelectValueError because the value didn't match any available option.
Fix Applied
File: openhands_cli/tui/modals/settings/settings_screen.py
• Changed line 177 from self.model_select.value = llm.model to self.model_select.value = model
• The model variable already contains just the model ID (extracted earlier via provider, model = llm.model.split("/", 1))
File: tests/refactor/modals/settings/test_settings_screen.py
• Updated the test to reflect the correct behavior where model options don't include the provider prefix
Verification
• All 55 tests in the settings module pass ✅
Checklist
- [ ] limited-student-10747
01/02/2026, 2:11 PMnutritious-balloon-65098
01/02/2026, 2:11 PMnutritious-balloon-65098
01/02/2026, 2:14 PMInvalidSelectValueError bug that occurs when opening settings in OpenHands-CLI v1.7.0 after configuring a cerebras model.
Root Cause
When loading settings in basic mode, the code was setting model_select.value to the full model string (e.g., cerebras/zai-glm-4.6), but the dropdown options only contain model IDs without the provider prefix (e.g., zai-glm-4.6). This mismatch caused the InvalidSelectValueError.
Fix Applied
Changed line 177 in settings_screen.py from:
self.model_select.value = llm.model # "cerebras/zai-glm-4.6"
to:
self.model_select.value = model # "zai-glm-4.6"
Verification
1. ✅ All 55 tests pass
2. ✅ Live verification script confirmed the fix works with cerebras/zai-glm-4.6 model
Changes Made
• openhands_cli/tui/modals/settings/settings_screen.py - Fixed the bug
• tests/refactor/modals/settings/test_settings_screen.py - Updated test to reflect correct behavior
Unable to Create PR
I was unable to push to GitHub and create a PR because there's no GITHUB_TOKEN environment variable available in this environment. The changes are committed locally on branch fix/model-select-invalid-value.
To create the PR manually, you can:
1. Clone the repo and apply this patch, or
2. Provide a GitHub token so I can push and create the PR
The commit is ready with message:
fix: use model_id without provider prefix when loading settings
Would you like me to provide the patch file, or can you provide GitHub credentials to push the changes?
View full conversationnutritious-balloon-65098
01/02/2026, 2:18 PMInvalidSelectValueError bug in OpenHands-CLI and created a draft PR.
Root Cause
When loading settings in basic mode, _load_current_settings() was setting model_select.value to the full model string (e.g., cerebras/zai-glm-4.6), but the dropdown options from get_model_options() only contain model IDs without the provider prefix (e.g., zai-glm-4.6). This caused the Textual Select widget to throw InvalidSelectValueError.
Fix
Changed line 177 in settings_screen.py to use the model variable (already extracted from splitting llm.model by /) instead of the full llm.model string:
# Before (buggy):
self.model_select.value = llm.model # "cerebras/zai-glm-4.6"
# After (fixed):
self.model_select.value = model # "zai-glm-4.6"
Verification
• ✅ All 55 existing tests pass
• ✅ Updated test to correctly reflect actual get_model_options() behavior
• ✅ Manually verified fix works with simulated cerebras/zai-glm-4.6 configuration
• ✅ Changes are minimal and focused (only 2 files changed, +7/-4 lines)
Draft PR Created
https://github.com/OpenHands/OpenHands-CLI/pull/280
-------------------------
How to Test This PR Using uvx
Users can test this fix directly from the PR branch using `uvx`:
# Install and run the CLI directly from the PR branch
uvx --from "git+<https://github.com/OpenHands/OpenHands-CLI.git@fix/model-select-invalid-value>" openhands
# Or if you want to specify the package name explicitly
uvx --from "openhands-cli @ git+<https://github.com/OpenHands/OpenHands-CLI.git@fix/model-select-invalid-value>" openhands
To reproduce the original bug and verify the fix:
1. Configure the CLI with cerebras/zai-glm-4.6 using the basic wizard
2. Restart the CLI
3. Open the command palette and go to Settings
4. Before fix: CLI crashes with InvalidSelectValueError: Illegal select value 'cerebras/zai-glm-4.6'
5. After fix: Settings screen opens correctly with the model dropdown showing zai-glm-4.6 selected
View full conversationlimited-student-10747
01/02/2026, 2:23 PMimportant-diamond-63626
01/02/2026, 3:18 PM