← Back to PRs

#17469: Improve unknown-model errors for provider/model misconfiguration

by megahappyclaw open 2026-02-15 19:54 View on GitHub →
agents stale size: XS
## Summary Improve diagnostics when a model references a provider prefix that isn't configured (common local proxy misconfiguration like `lmstudio/...` vs `models.providers.lmproxy`). ## What changed - `resolveModel()` now appends actionable hints to unknown-model errors: - Lists configured custom providers when provider is missing. - Detects normalized provider mismatch and reports the configured key(s). - Added test coverage in `src/agents/pi-embedded-runner/model.test.ts` for provider-hint behavior. - Relaxed a few brittle equality assertions to `toContain` in unknown-model tests. ## Why Today this failure mode can look like transport/network trouble ("no socket opened") even though resolution failed pre-transport. This patch makes failures immediate and obvious so users can fix config quickly. ## Example Before: - `Unknown model: lmstudio/minicpm-o-4_5` After: - `Unknown model: lmstudio/minicpm-o-4_5. Configured custom providers: "lmproxy".` ## Notes - I couldn't run vitest in this environment because `pnpm` is not installed on this host. <!-- greptile_comment --> <h3>Greptile Summary</h3> Enhanced error diagnostics in `resolveModel()` to provide actionable hints when a model references an unconfigured provider prefix. The implementation correctly handles two scenarios: detecting normalized provider mismatches (e.g., requesting `lmstudio` when `lmproxy` is configured) and listing all configured custom providers when no match is found. **Key changes:** - Error messages now append helpful context: configured provider names or mismatch details (lines 96-113 in model.ts) - Unit tests relaxed from `.toBe()` to `.toContain()` to accommodate variable error suffixes - New test case validates provider hint behavior for common misconfiguration scenario **Issues found:** - E2e test at model.e2e.test.ts:61 still uses strict `.toBe()` assertion and will fail with the new error format that includes a trailing period <h3>Confidence Score: 4/5</h3> - Safe to merge after fixing the e2e test assertion - The implementation logic is sound and well-tested, with appropriate normalization and matching. The error message construction is clear and helpful. However, the e2e test will fail due to a brittle assertion that wasn't updated alongside the unit tests, preventing a clean merge until fixed. - model.e2e.test.ts requires the assertion fix before merge <sub>Last reviewed commit: 241a058</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs