{"record":{"id":"b7aee238f5f25196","repo":"microsoft/vscode","slug":"failed-to-fetch-models-from-ollama-please-ensure","errorCode":null,"errorMessage":"Failed to fetch models from Ollama. Please ensure Ollama is running. If ollama is on another host, please configure the `\"github.copilot.chat.byok.ollamaEndpoint\"` setting.","messagePattern":"Failed to fetch models from Ollama\\. Please ensure Ollama is running\\. If ollama is on another host, please configure the `\"github\\.copilot\\.chat\\.byok\\.ollamaEndpoint\"` setting\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/copilot/src/extension/byok/vscode-node/ollamaProvider.ts","lineNumber":133,"sourceCode":"\t\t\t\t\tmaxInputTokens: modelInfo.capabilities.limits?.max_prompt_tokens ?? 4096,\n\t\t\t\t\tmaxOutputTokens: modelInfo.capabilities.limits?.max_output_tokens ?? 4096,\n\t\t\t\t\tname: modelInfo.name,\n\t\t\t\t\ttoolCalling: !!modelInfo.capabilities.supports.tool_calls,\n\t\t\t\t\tvision: !!modelInfo.capabilities.supports.vision\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn byokKnownModelsToAPIInfoWithEffort(this._name, this._knownModels).map(model => ({\n\t\t\t\t...model,\n\t\t\t\turl: ollamaBaseUrl\n\t\t\t}));\n\n\t\t} catch (e) {\n\t\t\t// Check if this is our version check error and preserve it\n\t\t\tif (e instanceof Error && e.message.includes('Ollama server version')) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\tthrow new Error('Failed to fetch models from Ollama. Please ensure Ollama is running. If ollama is on another host, please configure the `\"github.copilot.chat.byok.ollamaEndpoint\"` setting.');\n\t\t}\n\t}\n\n\tprotected override getModelsBaseUrl(configuration: OllamaConfig | undefined): string {\n\t\treturn configuration?.url ?? 'http://localhost:11434';\n\t}\n\n\tprotected override async createOpenAIEndPoint(model: OpenAICompatibleLanguageModelChatInformation<OllamaConfig>): Promise<OpenAIEndpoint> {\n\t\tconst modelInfo = this.getModelInfo(model.id, model.url);\n\t\tconst url = `${model.url}/v1/chat/completions`;\n\t\treturn this._instantiationService.createInstance(OpenAIEndpoint, modelInfo, model.configuration?.apiKey ?? '', url);\n\t}\n\n\tprivate async _getOllamaModelInfo(ollamaBaseUrl: string, modelId: string): Promise<IChatModelInformation> {\n\t\tconst modelInfo = await this._fetchOllamaModelInformation(ollamaBaseUrl, modelId);\n\t\tconst contextWindow = modelInfo?.model_info?.[`${modelInfo.model_info['general.architecture']}.context_length`] ?? 32768;\n\t\tconst outputTokens = contextWindow < 4096 ? Math.floor(contextWindow / 2) : 4096;\n\t\tconst modelCapabilities = {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/microsoft/vscode/blob/a94b963a32aa9749d69504576791fa29700ae46d/extensions/copilot/src/extension/byok/vscode-node/ollamaProvider.ts#L115-L151","documentation":"Error \"Failed to fetch models from Ollama. Please ensure Ollama is running. If ollama is on another host, please configure the `\"github.copilot.chat.byok.ollamaEndpoint\"` setting.\" thrown in microsoft/vscode.","triggerScenarios":"Thrown at extensions/copilot/src/extension/byok/vscode-node/ollamaProvider.ts:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"a94b963a32aa9749d69504576791fa29700ae46d","analyzedAt":"2026-08-12T01:08:56.794Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}