Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(chat): explain opaque custom provider 400s (#6786)

Ezra Ellette2c0a8f417610
diff --git a/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts b/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts
index 1fe7cb3ac..685ea6986 100644
--- a/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts
+++ b/apps/screenpipe-app-tauri/lib/chat/__tests__/provider-errors.test.ts
@@ -219,6 +219,23 @@ describe("provider error copy", () => {
expect(msg).toContain("Test Connection");
});
+ it("maps the opaque custom-provider 400 to safe preset guidance", () => {
+ expect(
+ buildProviderErrorMessage("400 status code (no body)", {
+ provider: "custom",
+ model: "gemini-2.5-flash",
+ }),
+ ).toBe(
+ "The custom AI provider rejected the request. Verify the endpoint, model, and API key in Settings → AI.",
+ );
+ expect(
+ buildProviderErrorMessage("400 status code (no body)", {
+ provider: "screenpipe-cloud",
+ model: "auto",
+ }),
+ ).toBeNull();
+ });
+
it("maps the ChatGPT missing-account-id error to reconnect guidance", () => {
// exact string thrown by pi's openai-codex-responses provider when the
// OAuth access token lacks the chatgpt_account_id claim (Enterprise/
diff --git a/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts b/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts
index dbbe6d8c6..4f700ec3e 100644
--- a/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts
+++ b/apps/screenpipe-app-tauri/lib/chat/provider-errors.ts
@@ -317,6 +317,10 @@ function buildGenericProviderErrorMessage(
return "The AI provider usage limit has been reached. Wait for it to reset, or switch your AI preset or provider.";
}
+ if (provider === "custom" && errorStr === "400 status code (no body)") {
+ return "The custom AI provider rejected the request. Verify the endpoint, model, and API key in Settings → AI.";
+ }
+
if (
provider === "custom" &&
(normalized.includes("401") ||