{"record":{"id":"370e6041e48083ee","repo":"gitbutlerapp/gitbutler","slug":"please-sign-in-to-use-gitbutler-s-ai-api","errorCode":null,"errorMessage":"Please sign in to use GitButler's AI API","messagePattern":"Please sign in to use GitButler's AI API","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/src/components/settings/AiCredentialCheck.svelte","lineNumber":77,"sourceCode":"\t\tabortController = new AbortController();\n\n\t\ttry {\n\t\t\t// Get current model kind\n\t\t\tmodelKind = await aiService.getModelKind();\n\t\t\tdebugInfo = `Model kind: ${modelKind}`;\n\n\t\t\t// Check if using GitButler API\n\t\t\tisUsingButlerAPI = await aiService.usingGitButlerAPI();\n\t\t\tdebugInfo += `, Using GB API: ${isUsingButlerAPI}`;\n\n\t\t\t// Check if configuration is valid\n\t\t\tconst isConfigValid = await aiService.validateConfiguration();\n\t\t\tdebugInfo += `, Config valid: ${isConfigValid}`;\n\n\t\t\tif (!isConfigValid) {\n\t\t\t\tif (modelKind === ModelKind.OpenAI || modelKind === ModelKind.Anthropic) {\n\t\t\t\t\tif (isUsingButlerAPI && !userService.user) {\n\t\t\t\t\t\tthrow new Error(\"Please sign in to use GitButler's AI API\");\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(\"Please provide a valid API key for your selected AI service\");\n\t\t\t\t\t}\n\t\t\t\t} else if (modelKind === ModelKind.Ollama) {\n\t\t\t\t\t// Get Ollama configuration for more detailed error\n\t\t\t\t\tconst endpoint = await aiService.getOllamaEndpoint();\n\t\t\t\t\tconst model = await aiService.getOllamaModelName();\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Please check Ollama configuration: endpoint=${endpoint}, model=${model}`,\n\t\t\t\t\t);\n\t\t\t\t} else if (modelKind === ModelKind.LMStudio) {\n\t\t\t\t\t// Get LM Studio configuration for more detailed error\n\t\t\t\t\tconst endpoint = await aiService.getLMStudioEndpoint();\n\t\t\t\t\tthrow new Error(`Please check LM Studio configuration: endpoint=${endpoint}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdebugInfo += `, Testing commit message generation`;","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/apps/desktop/src/components/settings/AiCredentialCheck.svelte#L59-L95","documentation":"Validation branch of the AI credential test: validateConfiguration() returned false for an OpenAI/Anthropic model kind while the app is set up to use GitButler's hosted AI API, but no user is signed in. The error identifies authentication as the fix rather than a missing key, because the hosted API is authorized through the GitButler account.","triggerScenarios":"Thrown at apps/desktop/src/components/settings/AiCredentialCheck.svelte:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Prompt the user to sign in to their GitButler account, then rerun the credential check","Offer switching to a bring-your-own-key model with a custom API key if they prefer not to sign in","Open the sign-in flow directly from the settings panel to reduce friction"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}