Rulesnorthwind-no-retry-on-network-error

northwind-no-retry-on-network-error

info

northwind/reliability/no-retry-on-network-error

Docs page ↗

The client is constructed with no maxNetworkRetries and the call site has no retry, so a transient ECONNRESET or 503 propagates to the user as a hard failure.

9

codebases affected, of 58

16%

of everything we scanned

no docs fix scored yet

0

docs commits aimed at this

Where it’s failing

Northwind client is constructed without maxNetworkRetries and the call site has no retry.

what we find

what we change it to

const northwind = new Northwind(process.env.NORTHWIND_API_KEY)
// one ECONNRESET during the TLS handshake → 500 at checkout
const charge = await northwind.charges.create(params)
const northwind = new Northwind(process.env.NORTHWIND_API_KEY, {
maxNetworkRetries: 2, // connection errors + 5xx, with backoff
timeout: 10_000,
})
const charge = await northwind.charges.create(params, {
idempotencyKey: `order-${order.id}`, // replayed by the retry
})

Set retries once on the client — new Northwind(key, { maxNetworkRetries: 2 }) — which retries only on connection errors and 5xx, with backoff, and reuses the idempotency key so retried writes cannot duplicate.

Metadata

Category
reliability
Type
suggestion
Severity
info
Recommended
yes
Languages
javascriptpython

Live telemetry

9 / 58 scans

Fired in 16% of scanned codebases.

After every docs commit

No docs commits target this rule yet. When one merges, the next weeks of scans re-score it here.

A fix for your docs page

Wherever this rule fires, a page on your docs site taught it. api-doctor writes the edit and opens it as a pull request on your docs repo — you review and merge.

No fix yet

Draft a docs fix for this rule

api-doctor writes the docs change from the fire pattern — you review it