#18988: feat(config): add support for config warnings and improve validation
commands
size: S
Cluster:
Wizard Enhancements and Config Fixes
Fixes #18968 — Graceful handling of invalid models.providers.<key>.api
When openclaw.json had an invalid value for models.providers.<provider>.api (e.g. "google-genai" instead of "google-generative-ai"), the Gateway exited on Zod validation and went into a crash loop.
Validation: If the only validation errors are under models.providers.<key>, we now strip those providers and re-validate instead of failing the whole config. The snapshot is valid, so the Gateway starts and other providers keep working.
Warnings: Disabled providers are recorded as config warnings (path + message, with supported API types when the error is about .api).
Status: openclaw status shows a “Model providers” row when any provider was disabled due to invalid config.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds graceful handling for invalid model provider configurations by stripping problematic providers and displaying warnings rather than crashing the Gateway.
- Introduced `tryValidateConfigRawWithLenientModelProviders` that validates configs and strips invalid providers if they're the only validation errors
- Config warnings are now surfaced in `openclaw status` command under "Model providers" when providers are disabled
- Updated `MODEL_API_VALUES` to derive from `ModelApiSchema` as previously suggested, ensuring error messages stay in sync
- Added comprehensive test coverage for the new validation behavior
<h3>Confidence Score: 5/5</h3>
- Safe to merge with thorough implementation and good test coverage
- The implementation is well-designed with proper error handling, fallback logic for `structuredClone`, comprehensive validation flow, and appropriate test coverage. The graceful degradation approach prevents crashes while maintaining system functionality.
- No files require special attention
<sub>Last reviewed commit: d923068</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19020: bugfix(gateway): Handle invalid model provider API config gracefully\…
by funkyjonx · 2026-02-17
88.9%
#9739: #9291 fix(models): preserve existing models in models.json when mer...
by ximzzzzz · 2026-02-05
79.6%
#16988: fix: always regenerate models.json from gateway config
by MisterGuy420 · 2026-02-15
79.3%
#9064: fix: validate model references against catalog in config.set/patch/...
by joetomasone · 2026-02-04
77.0%
#8546: Fix/config UI improvements
by RandomRaine · 2026-02-04
75.8%
#21884: feat(models): auth improvements — status command, heuristics, multi...
by kckylechen1 · 2026-02-20
75.6%
#16290: fix: add field-level validation for custom LLM provider config
by superlowburn · 2026-02-14
75.6%
#9163: Fix: Save Anthropic setup token to config file
by vishaltandale00 · 2026-02-04
75.4%
#20965: feat: Add comprehensive model configuration and discovery for various…
by rodeok · 2026-02-19
75.4%
#5823: fix(config): exit cleanly on invalid config instead of high CPU loop
by gavinbmoore · 2026-02-01
75.3%