Skip to content

fix: include the network cause in transport errors - #376

Merged
rponeawa merged 1 commit into
mainfrom
fix/transport-error-cause
Oct 1, 2026
Merged

rponeawa merged 1 commit into
mainfrom
fix/transport-error-cause

Conversation

@rponeawa

@rponeawa rponeawa commented Oct 1, 2026

Copy link
Copy Markdown
Member

Problem

Node's fetch reports every network-level failure as TypeError: fetch failed and keeps the actual reason on error.cause. transport() copied only error.message, so a user whose HypiHub catalogue check failed saw:

HypiHub model catalogue check failed; model=seedance-2.5; operation=videos; references uploaded=0; generation not submitted: fetch failed

That cannot distinguish DNS, TLS, a connection reset, a timeout or a proxy problem, and in this case it was misread as an upstream provider outage.

Change

transport() now appends the cause's code and message to the EndpointTransportError message. Every provider's network failures pass through this function, so catalogue reads, OAuth refresh, uploads and downloads all gain the reason without changing any call site. The original message stays as the prefix, and cause is still attached.

Result

Measured by sending real failing requests through transport():

Failure Before After
DNS fetch failed fetch failed: getaddrinfo ENOTFOUND no-such-host.invalid
Certificate fetch failed fetch failed: CERT_HAS_EXPIRED certificate has expired
Connect timeout fetch failed fetch failed: UND_ERR_CONNECT_TIMEOUT Connect Timeout Error (attempted address: 10.255.255.1:80, timeout: 10000ms)
Forbidden port fetch failed fetch failed: bad port

The cause text comes from Node's network layer (host, address and port, error code, certificate reason). It does not contain URL paths, query strings or headers, so signed download URLs and tokens do not appear in it.

Verification

  • pnpm check passes.
  • The 15 existing test files that import endpoint-kit or provider-hypihub: 145 tests, 142 passed, 3 skipped, 0 failed. The full pnpm test was not run locally.
  • No tests were added.

Node's fetch reports every network failure as "fetch failed" and keeps
the reason on error.cause, which transport() dropped. Users reporting a
failed HypiHub catalogue check could not tell DNS, TLS, a reset or a
timeout apart.
@rponeawa
rponeawa merged commit adc0c5f into main Oct 1, 2026
8 checks passed
854771076 pushed a commit to 854771076/hypit that referenced this pull request Oct 9, 2026
Node's fetch reports every network failure as "fetch failed" and keeps
the reason on error.cause, which transport() dropped. Users reporting a
failed HypiHub catalogue check could not tell DNS, TLS, a reset or a
timeout apart.
@overlordkim
overlordkim deleted the fix/transport-error-cause branch October 9, 2026 10:53
SanHsien pushed a commit to SanHsien/hypit that referenced this pull request Oct 24, 2026
Node's fetch reports every network failure as "fetch failed" and keeps
the reason on error.cause, which transport() dropped. Users reporting a
failed HypiHub catalogue check could not tell DNS, TLS, a reset or a
timeout apart.

(cherry picked from commit adc0c5f)
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.

1 participant