fix(copilot): guard empty models[].url in custom endpoint and show clear config error - #333702
Open
Birarpanjot Singh Kanwer (arpankanwer) wants to merge 2 commits into
Conversation
…ear config error Wizard was saving endpoint as group name leaving models[].url empty, causing TypeError: Cannot read properties of undefined (reading 'includes') in createOpenAIEndPoint. Validate url, handle undefined in hasExplicitApiPath/inferApiTypeFromUrl, and throw clear error pointing to chatLanguageModels.json. Fixes microsoft#333701
Author
|
@microsoft-github-policy-service agree |
Birarpanjot Singh Kanwer (arpankanwer)
requested a balanced review from Copilot
September 1, 2026 02:24
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.
Fixes #333701
Problem
Custom Endpoint wizard saves endpoint as
nameleavingmodels[].url="".createOpenAIEndPointthen callsurl.includes()on empty/undefined → TypeError: Cannot read properties of undefined (reading 'includes') at extension.js:1598:8522Fix
hasExplicitApiPath/inferApiTypeFromUrlhandle undefined → false / 'chat-completions'resolveCustomEndpointUrlvalidates http(s) and throws clear error for missing urlcreateOpenAIEndPointchecksrawUrl = modelConfiguration.url ?? model.url ?? configuration.urland throws actionable error pointing to chatLanguageModels.json and Custom Endpoint wizard saves the endpoint as the group name and leaves models[].url empty #333701Test
Repro with bad JSON:
Custom endpoint model 'or-free' is missing required 'models[].url'. Please configure a valid http(s) URL in chatLanguageModels.json...Validated:
node /tmp/repro_333701_without_fix.js→ TypeErrornode /tmp/repro_333701_with_fix.js→ clear error + valid URLs still resolve correctly