Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(updater): a GitHub 5xx during the update check is not a failed verification

AdityaUmale47f334558d8d
diff --git a/electron/update-errors.mjs b/electron/update-errors.mjs
index 8f9f30eaa4..818754c3fa 100644
--- a/electron/update-errors.mjs
+++ b/electron/update-errors.mjs
@@ -17,7 +17,8 @@ export function updateErrorNeedsPerson(error) {
}
export function updateErrorCode(error) {
- const message = String(error?.message ?? error ?? "Update failed");
+ // electron-updater appends the whole releases feed (release notes included) to ERR_UPDATER_INVALID_RELEASE_FEED; only the error before it says what failed.
+ const message = String(error?.message ?? error ?? "Update failed").split("\nXML:\n")[0];
const detail = `${error?.code ?? ""} ${message}`;
// Installer errors may mention SignerCertificate details; that must not read as network advice.
const integrity = /ERR_UPDATER_(?:INVALID_SIGNATURE|CHECKSUM_MISMATCH)/i.test(detail);
@@ -29,6 +30,8 @@ export function updateErrorCode(error) {
if (/\b(?:EACCES|EPERM)\b|read.only (?:volume|file system)|permission denied|access is denied/i.test(detail)) return "permission";
if (/\bEBUSY\b|being used by another process/i.test(detail)) return "busy";
if (/certificate/i.test(detail)) return "tls";
+ // The same error wraps a failed GitHub request, such as a 504 while looking up the latest release.
+ if (/ERR_UPDATER_INVALID_RELEASE_FEED/.test(detail) && /HttpError: 5\d\d\b/.test(message)) return "network";
if (/\b404\b|cannot find .*\.yml|cannot parse update info|no files provided|ERR_UPDATER_INVALID_RELEASE_FEED/i.test(detail)) return "feed";
if (/\b(?:ENOTFOUND|ECONNREFUSED|ECONNRESET|ETIMEDOUT|EAI_AGAIN)\b|net::ERR_|\bHTTP[^\n]*\b5\d\d\b|status(?: code)?[: ]+5\d\d\b/i.test(detail)) return "network";
if (message === UPDATE_TEXT.prepareTimeout) return "prepareTimeout";
diff --git a/electron/update-errors.node-test.mjs b/electron/update-errors.node-test.mjs
index ee9b9cadb7..950d176536 100644
--- a/electron/update-errors.node-test.mjs
+++ b/electron/update-errors.node-test.mjs
@@ -34,6 +34,20 @@ test("only failures the person must fix are theirs to see when nobody asked", ()
}
});
+test("a server error wrapped with the release feed is a network failure, whatever the release notes say", () => {
+ // electron-updater wraps a failed GitHub request in "Cannot parse releases feed" and appends the whole feed, release notes included.
+ const feed = '<?xml version="1.0"?><feed><entry><content>Fix Gemini thought signature and certificate handling; checksum 404 cleanup</content></entry></feed>';
+ const error = Object.assign(
+ new Error(`Cannot parse releases feed: Error: Unable to find latest version on GitHub (https://github.com/o/r/releases/latest), please ensure a production release exists: HttpError: 504 Gateway Time-out\n"<html>The server didn't respond in time.</html>"\nHeaders: {}\n at createHttpError (builder-util-runtime/out/httpExecutor.js:20:12),\nXML:\n${feed}`),
+ { code: "ERR_UPDATER_INVALID_RELEASE_FEED" },
+ );
+ assert.equal(updateErrorNeedsPerson(error), false);
+ assert.match(updateErrorMessage(error), /connection and try again/);
+ const brokenFeed = Object.assign(new Error(`Cannot parse releases feed: TypeError: Cannot read properties of null,\nXML:\n${feed}`), { code: "ERR_UPDATER_INVALID_RELEASE_FEED" });
+ assert.equal(updateErrorNeedsPerson(brokenFeed), false);
+ assert.match(updateErrorMessage(brokenFeed), /missing or invalid/);
+});
+
test("actionable messages do not permit retrying failed native staging", async () => {
const updater = new EventEmitter();
let state = {};