{"record":{"id":"18373c13c4aa2845","repo":"gitbutlerapp/gitbutler","slug":"when-using-lm-studio-you-must-provide-a-valid-end","errorCode":null,"errorMessage":"When using LM Studio, you must provide a valid endpoint","messagePattern":"When using LM Studio, you must provide a valid endpoint","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/src/lib/ai/service.ts","lineNumber":331,"sourceCode":"\t\t\tif (!get(this.tokenMemoryService.token)) {\n\t\t\t\tthrow new Error(\"When using GitButler's API to summarize code, you must be logged in\");\n\t\t\t}\n\n\t\t\treturn new ButlerAIClient(this.cloud, modelKind);\n\t\t}\n\n\t\tif (modelKind === ModelKind.Ollama) {\n\t\t\tconst ollamaEndpoint = await this.getOllamaEndpoint();\n\t\t\tconst ollamaModelName = await this.getOllamaModelName();\n\t\t\treturn new OllamaClient(ollamaEndpoint, ollamaModelName);\n\t\t}\n\n\t\tif (modelKind === ModelKind.LMStudio) {\n\t\t\tconst lmStudioEndpoint = await this.getLMStudioEndpoint();\n\t\t\tconst lmStudioModelName = await this.getLMStudioModelName();\n\n\t\t\tif (!lmStudioEndpoint) {\n\t\t\t\tthrow new Error(\"When using LM Studio, you must provide a valid endpoint\");\n\t\t\t}\n\n\t\t\treturn new LMStudioClient(lmStudioEndpoint, lmStudioModelName);\n\t\t}\n\n\t\tif (modelKind === ModelKind.OpenAI) {\n\t\t\tconst openAIModelName = await this.getOpenAIModelName();\n\t\t\tconst openAIKey = await this.getOpenAIKey();\n\t\t\tconst openAICustomEndpoint = await this.getOpenAICustomEndpoint();\n\n\t\t\tif (!openAIKey) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"When using OpenAI in a bring your own key configuration, you must provide a valid token\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn new OpenAIClient(openAIKey, openAIModelName, openAICustomEndpoint);\n\t\t}","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/apps/desktop/src/lib/ai/service.ts#L313-L349","documentation":"buildClient() throws this when the configured model kind is LM Studio but no endpoint URL is configured (getLMStudioEndpoint() returned an empty/falsy value). A LMStudioClient cannot be constructed without a server URL.","triggerScenarios":"User selects LM Studio as AI provider but the endpoint setting is empty or unset.","commonSituations":"Fresh install with LM Studio chosen but endpoint never filled in; settings cleared after reset/migration; endpoint stored in a settings key that was renamed in an update.","solutions":["Set the LM Studio endpoint in AI settings (e.g. http://localhost:1234/v1).","Start LM Studio's local server and copy the advertised endpoint URL.","Re-save AI settings if a migration/reset cleared them."],"exampleFix":"// before\nlMStudioEndpoint: ''\n// after\nlMStudioEndpoint: 'http://localhost:1234/v1'","handlingStrategy":"validation","validationCode":"const endpoint = await aiService.getLMStudioEndpoint();\nif (!endpoint) {\n  // show settings UI asking for the LM Studio endpoint before invoking AI\n}","typeGuard":null,"tryCatchPattern":"try {\n  await aiService.summarize(...);\n} catch (e) {\n  if (e.message.includes('must provide a valid endpoint')) {\n    // open AI settings to let the user enter the endpoint\n  } else {\n    throw e;\n  }\n}","preventionTips":["Fill in the LM Studio endpoint whenever you select the LM Studio provider.","Validate the endpoint URL format (http(s)://host:port/v1) when saving settings.","Re-check settings after app updates or resets."],"tags":["configuration","missing-config","lm-studio"],"backgroundTag":"missing-required-config-field","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}