Skip to content

fix(nodeenv): report a missing node archive instead of a traceback - #412

Merged
ekalinin merged 1 commit into
masterfrom
fix/node-404-error-message
Sep 22, 2026
Merged

ekalinin merged 1 commit into
masterfrom
fix/node-404-error-message

Conversation

@ekalinin

Copy link
Copy Markdown
Owner

Closes #250

Problem

A 404 on the node.js archive ended in a raw urllib traceback:

 * Install prebuilt node (99.99.99) ..
Traceback (most recent call last):
  ...
urllib.error.HTTPError: HTTP Error 404: Not Found

Worse, on arm64 the url was never named at all. The x64 retry ran inside
the except urllib2.HTTPError block, so a second 404 was raised "during
handling of the above exception" (hence the doubled traceback in the issue),
and logger.warning('Failed to download from %s') was never reached.

Fix

  • Build the list of urls to try up front, so the x64 retry happens outside the
    handler and failures are no longer chained.
  • Report every attempted url with its http status, and add a hint about
    --list / --source when the archive is simply not there.

Before:

 * Install prebuilt node (99.99.99) ..
Traceback (most recent call last):
  ... 40 lines ...
urllib.error.HTTPError: HTTP Error 404: Not Found

After:

 * Install prebuilt node (99.99.99) ..
Error: cannot download https://nodejs.org/download/release/v99.99.99/node-v99.99.99-darwin-arm64.tar.gz: HTTP 404 Not Found
Error: cannot download https://nodejs.org/download/release/v99.99.99/node-v99.99.99-darwin-x64.tar.gz: HTTP 404 Not Found
Error: there is no prebuilt node.js 99.99.99 for darwin-arm64
Error: check "nodeenv --list" for the available versions, or build from source with --source

A non-404 status (500, 403) is reported with its url and status, without the
"try another version" advice.

Tests

Four new tests cover the prebuilt 404, the arm64 fallback that also 404s, the
--source 404 and a 500. Five existing tests asserted pytest.raises(HTTPError)
and were updated to SystemExit; their assertions sat inside the raises block
and never ran, so they were moved out.

Manually verified on darwin-arm64: 22.11.0 installs, 14.21.3 still falls back to
x64, 99.99.99 fails with the message above.

A 404 on the node.js archive ended in a raw urllib traceback, without
even naming the url when the arm64 build was missing: the x64 retry ran
inside the "except HTTPError" block, so the second failure was chained
onto the first and the warning with the url was never reached.

Collect the attempted urls, retry outside the handler and report every
one of them with the http status, plus a hint about "--list" and
"--source" when the archive is simply not there.

Closes #250
@ekalinin
ekalinin merged commit 3b8fdce into master Sep 22, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message when platform node binaries do not exist

1 participant