feat(proxy): add error_type zod enum to all LLM proxy error responses#2491
Merged
Conversation
Contributor
Author
Code Review SummaryStatus: 4 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)No new diff-line issues in the incremental changes. The remaining warning-level gaps are unchanged pass-through/auth paths that still return some proxy errors without Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (5 files)
Reviewed by gpt-5.4-2026-03-05 · 764,953 tokens |
…cover all route-level errors - Move proxyErrorTypeSchema to dedicated proxy-error-types.ts - Rename forbidden_free_model => discontinued_free_model - Add error_type to inline error responses in openrouter, embeddings, and FIM routes
marius-kilocode
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
proxyErrorTypeSchemazod enum and anerror_typeproperty to every error HTTP response inllm-proxy-helpers.ts. This gives clients a machine-readable, stable error classifier they can switch on instead of parsing free-texterror/messagestrings.The enum covers all 15 error paths:
invalid_path,invalid_request,temporarily_unavailable,upgrade_required,usage_limit_exceeded,data_collection_required,api_kind_not_supported,stealth_model_error,byok_error,context_length_exceeded,model_not_allowed,forbidden_free_model,model_not_found,feature_exclusive_model,unsupported_field.Each literal is typed with
satisfies ProxyErrorTypeso the compiler catches any mismatch with the enum.Verification
tsc --noEmitagainstapps/web— no type errors in the changed filepnpm format— no formatting issuesVisual Changes
N/A
Reviewer Notes
errorfield is left unchanged so existing clients are unaffected;error_typeis purely additive.usageLimitExceededResponsehas a nestederrorobject (consumed by the extension);error_typeis placed at the top level alongside it.