bug(updater): AppImage differential download always fails with NaN RangeError, falls back to full download
Bug
On Linux, the AppImage differential (blockmap) update download always fails with RangeError [ERR_OUT_OF_RANGE] computing a NaN size, then silently falls back to a full download. Not fatal (the fallback works), but the differential-download path is effectively dead in practice, and every nightly re-downloads the full ~186MB build instead of a small delta.
Source: local occurrence, live stack trace captured | Reported by: @Ayash-Bera | Analyzed against: 3e46ad3b4 (origin/main)
Confidence: High
Reproduction
- Have a previous nightly AppImage installed with electron-updater's cache dir populated from a prior run.
- Trigger an update check with a newer nightly available.
- Observe electron-updater attempt a differential (blockmap) download before falling back.
Captured live:
Found version 0.13.1-nightly.202609171740 (url: Agent.Orchestrator-0.13.1-nightly.202609171740.AppImage)
Downloading update from Agent.Orchestrator-0.13.1-nightly.202609171740.AppImage
updater cache dir: /home/ghoul/.cache/agent-orchestrator-updater
Cached update file doesn't exist
Cannot download differentially, fallback to full download: RangeError [ERR_OUT_OF_RANGE]: The value of "size" is out of range. It must be >= 0 && <= 34359738367. Received NaN
at Function.allocUnsafe (node:buffer:403:3)
at e.FileWithEmbeddedBlockMapDifferentialDownloader.readRemoteBytes (.../main.js:62:11434)
at e.FileWithEmbeddedBlockMapDifferentialDownloader.download (.../main.js:62:29005)
at e.AppImageUpdater.downloadDifferential (.../main.js:62:31046)
at Object.task (.../main.js:62:30526)
at e.AppImageUpdater.executeDownload (.../main.js:62:23685)
New version 0.13.1-nightly.202609171740 has been downloaded to /home/ghoul/.cache/agent-orchestrator-updater/pending/Agent.Orchestrator-0.13.1-nightly.202609171740.AppImage
Root Cause
The log states "Cached update file doesn't exist" immediately before attempting the differential download anyway. readRemoteBytes in electron-updater's FileWithEmbeddedBlockMapDifferentialDownloader computes a byte range from a size it never obtained (no cached old file to diff against, or a blockmap header it could not read), producing NaN, which Buffer.allocUnsafe then rejects. This is upstream electron-updater behavior, not AO application code, but AO's build/publish pipeline controls whether blockmaps are published at all and whether differential updates are enabled for the nightly channel.
Fix
Either resolves it:
- Disable differential updates for the AppImage/nightly target in the electron-builder/forge publish config, since the "cached file doesn't exist" precondition appears to be the common case on this channel and the fallback always fires anyway.
- Or guard the differential path so it does not attempt to diff when there is no cached file locally, going straight to full download instead of throwing and catching.
Impact
Cosmetic log noise plus wasted bandwidth (full ~186MB re-download every nightly instead of a delta). No functional breakage since the fallback always succeeds.
Related
- #3528: different silent-updater-failure pattern (Windows/Squirrel ENOSPC), same "diff/patch download quietly falls over" theme.