Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(startup): fail closed on key inspection errors
Kfir Amarda39e1485fd4
diff --git a/electron/main.js b/electron/main.jsindex 2cba05f8e2..95838d9e9b 100644--- a/electron/main.js+++ b/electron/main.js@@ -116,8 +116,9 @@ function hasEncryptedCredentials(dbPath) {} finally {db.close();}- } catch {- return false;+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ throw new Error(`Unable to inspect existing database at ${dbPath}: ${message}`);}}diff --git a/scripts/bootstrap-env.mjs b/scripts/bootstrap-env.mjsindex 46ac7d0795..2e0a0a059e 100644--- a/scripts/bootstrap-env.mjs+++ b/scripts/bootstrap-env.mjs@@ -87,8 +87,9 @@ function hasEncryptedCredentials(dataDir) {} finally {db.close();}- } catch {- return false;+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ throw new Error(`Unable to inspect existing database at ${dbPath}: ${message}`);}}diff --git a/tests/unit/bootstrap-env.test.mjs b/tests/unit/bootstrap-env.test.mjsindex 019f65b790..e8d271fb53 100644--- a/tests/unit/bootstrap-env.test.mjs+++ b/tests/unit/bootstrap-env.test.mjs@@ -89,3 +89,14 @@ test("bootstrapEnv refuses to generate a new key over encrypted data", () => {);});});++test("bootstrapEnv fails closed when existing database cannot be inspected", () => {+ withTempEnv(({ dataDir }) => {+ fs.mkdirSync(path.join(dataDir, "storage.sqlite"), { recursive: true });++ assert.throws(+ () => bootstrapEnv({ quiet: true }),+ /Unable to inspect existing database/+ );+ });+});