gitbutlerapp/gitbutler · warning · Error
Please sign in to use GitButler's AI API
Error message
Please sign in to use GitButler's AI API
What it means
Thrown by the AI settings credential check when validateConfiguration() reports the AI config invalid, usingGitButlerAPI() is true (requests would route through GitButler's hosted AI), and userService.user is null. It distinguishes 'not signed in' from a bad key so the UI can point at account state rather than the key field.
Source
Thrown at apps/desktop/src/components/settings/AiCredentialCheck.svelte:77
abortController = new AbortController();
try {
// Get current model kind
modelKind = await aiService.getModelKind();
debugInfo = `Model kind: ${modelKind}`;
// Check if using GitButler API
isUsingButlerAPI = await aiService.usingGitButlerAPI();
debugInfo += `, Using GB API: ${isUsingButlerAPI}`;
// Check if configuration is valid
const isConfigValid = await aiService.validateConfiguration();
debugInfo += `, Config valid: ${isConfigValid}`;
if (!isConfigValid) {
if (modelKind === ModelKind.OpenAI || modelKind === ModelKind.Anthropic) {
if (isUsingButlerAPI && !userService.user) {
throw new Error("Please sign in to use GitButler's AI API");
} else {
throw new Error("Please provide a valid API key for your selected AI service");
}
} else if (modelKind === ModelKind.Ollama) {
// Get Ollama configuration for more detailed error
const endpoint = await aiService.getOllamaEndpoint();
const model = await aiService.getOllamaModelName();
throw new Error(
`Please check Ollama configuration: endpoint=${endpoint}, model=${model}`,
);
} else if (modelKind === ModelKind.LMStudio) {
// Get LM Studio configuration for more detailed error
const endpoint = await aiService.getLMStudioEndpoint();
throw new Error(`Please check LM Studio configuration: endpoint=${endpoint}`);
}
}
debugInfo += `, Testing commit message generation`;View on GitHub (pinned to caf1f223d3)
Solutions
- Sign in via Account settings and run the check again.
- If you did not intend to use the hosted API, switch the AI provider to your own key and save.
Defensive patterns
Strategy: validation
Validate before calling
const usingButlerAPI = await aiService.usingGitButlerAPI();
if (usingButlerAPI && !userService.user) {
error = "Sign in to GitButler to use the hosted AI API";
return;
}
// run the credential check Type guard
const isSignedIn = (u: { id: string } | null | undefined): u is { id: string } => u != null; Try / catch
try {
await runCheck();
} catch (e) {
if (e instanceof Error && e.message.includes("sign in")) {
error = "Sign in from Account settings, then test again.";
} else {
error = e instanceof Error ? e.message : "Unknown error";
}
} Prevention
- Check userService.user before enabling the hosted-API option in AI settings.
- Sign out should also reset the AI provider away from the hosted API.
- Treat session-expiry events as a trigger to re-validate AI configuration.
When it happens
Trigger: Pressing the test/check button in Settings with the GitButler-hosted OpenAI/Anthropic option selected while the app has no signed-in user (session expired or never started).
Common situations: Session token expired after leaving the app open; user signed out in Account settings but AI provider still set to the hosted API; fresh install where sign-in was skipped during onboarding.
Related errors
- Please provide a valid API key for your selected AI service
- Please check Ollama configuration: endpoint=${endpoint}, mod
- Please check LM Studio configuration: endpoint=${endpoint}
- Received empty response from AI service
- No branch selected!
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/370e6041e48083ee.
Report an issue: GitHub.