Retry After What? — JavaScript Bug Hunt
Inspired by the API clients that hammer rate-limited services into the ground.
- Language: JavaScript
- Layer: Backend
- Difficulty: Medium
- Concepts: HTTP, Parsing
- Modelled on: Slack API clients
- Visible tests: numeric seconds become milliseconds; http dates wait until the date; missing header falls back to one second
- Reward: 50 XP for a complete fix
Incident
- Severity: SEV-2 (priority: High)
- Ticket: BUG-429
- Reported by: integrations
- Time to fix: 20 minutes, the target for a medium incident
Failing checks on the shipped build
- numeric seconds become milliseconds — expected 30000 but got 30
- http dates wait until the date — expected 1680000 but got null
- missing header falls back to one second — expected 1000 but got null
How to work this incident
- Read the report: write down the expected behaviour and the actual one in a sentence each.
- Reproduce it: run the visible tests and find the failing check that matches the report.
- Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
- Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
- Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.
Briefing
Inspired by the API clients that hammer rate-limited services into the ground. The Retry-After header legally comes in TWO shapes — a number of seconds, or an HTTP date — and this client handles neither correctly.
Fix backoff.js before the vendor blocks the whole IP range.
Bug report
BUG-429 · Priority: High · Reported by: integrations
retryDelayMs(retryAfter, nowMs):
- numeric string ("30") -> that many SECONDS, as milliseconds
- HTTP date string -> delay until that date (clamped to >= 0)
- missing/unparseable -> default 1000ms
Observed: "30" is treated as 30 MILLISECONDS, and date headers become NaN, so the client retries instantly, forever.
Logs
[client] 429 retry-after="30" -> sleeping 30ms
[client] 429 retry-after="Wed, 21 Oct 2026 07:28:00 GMT" -> sleeping NaNThe code as shipped
src/http/backoff.js (editable)
// Turns a Retry-After header into a delay in milliseconds.
exports.retryDelayMs = function (retryAfter, nowMs) {
return parseInt(retryAfter, 10);
};
Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More JavaScript bug hunts.