gitbutlerapp/gitbutler · error

Received empty response from AI service

Error message

Received empty response from AI service

What it means

After a completed AI round-trip in the credential check, both the direct result and the accumulated streamed tokens came back empty or whitespace-only. The service responded without an error but produced no usable text, indicating a provider-side or model-configuration problem (empty completions) rather than a connectivity or auth failure.

Solutions

  1. Retry the test once - transient empty completions occur, especially with streamed models
  2. Try a different model name in AI settings in case the selected model returns empty output
  3. Check the provider's status page or local server logs for why completions come back empty
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at apps/desktop/src/components/settings/AiCredentialCheck.svelte:149 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/72ab06989547f518. Report an issue: GitHub.

Appendix: source

Thrown at apps/desktop/src/components/settings/AiCredentialCheck.svelte:149

					// Append each token as it comes in
					streamingResult += token;
				},
			});

			// Clear the timeout since we got a result
			if (testTimeout) {
				clearTimeout(testTimeout);
				testTimeout = null;
			}

			// Set the final result (handling undefined case)
			result = aiResult || streamingResult || null;

			debugInfo += `, Received commit message: ${result?.substring(0, 30)}${result && result.length > 30 ? "..." : ""}`;

			// If result is empty or undefined, show an error
			if (!result || result.trim() === "") {
				throw new Error("Received empty response from AI service");
			}
		} catch (e) {
			console.error("AI credential check error:", e);

			// Don't show abort errors as they're expected when we cancel the request
			if (e instanceof Error && e.name === "AbortError") {
				error = "AI request was cancelled";
			} else {
				error = e instanceof Error ? e.message : "Unknown error occurred";
			}

			debugInfo += `, Error: ${error}`;

			// Clear the timeout if there was an error
			if (testTimeout) {
				clearTimeout(testTimeout);
				testTimeout = null;
			}

View on GitHub (pinned to 58e5313667)