{"record":{"id":"f472ce6ce975385d","repo":"jackwener/OpenCLI","slug":"label-returned-http-res-status","errorCode":null,"errorMessage":"${label} returned HTTP ${res.status}","messagePattern":"(.+?) returned HTTP (.+?)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/dblp/utils.js","lineNumber":50,"sourceCode":"    try {\n        res = await fetch(url, {\n            headers: {\n                accept,\n                'user-agent': 'opencli-dblp/1.0 (+https://github.com/jackwener/opencli)',\n            },\n        });\n    }\n    catch (err) {\n        throw new CommandExecutionError(`${label} request failed: ${err?.message ?? err}`, 'Check that dblp.org is reachable from this network.');\n    }\n    if (!res.ok) {\n        if (res.status === 429) {\n            throw new CommandExecutionError(`${label} returned HTTP 429 (rate limited)`, 'dblp throttles clients that fetch too aggressively. Wait a few seconds and retry, or lower --limit.');\n        }\n        if (res.status === 404) {\n            throw new EmptyResultError(label, 'dblp returned 404 — the requested record may not exist.');\n        }\n        throw new CommandExecutionError(`${label} returned HTTP ${res.status}`, 'Inspect the response in a browser at the same URL for more context.');\n    }\n    return res;\n}\n\nexport async function dblpFetchJson(path, label) {\n    const res = await dblpFetch(`${DBLP_ORIGIN}${path}`, label, 'application/json');\n    let body;\n    try {\n        body = await res.json();\n    }\n    catch (err) {\n        throw new CommandExecutionError(`${label} returned malformed JSON: ${err?.message ?? err}`);\n    }\n    const statusCode = String(body?.result?.status?.['@code'] ?? '').trim();\n    if (!statusCode) {\n        throw new CommandExecutionError(\n            `${label} returned JSON without result.status.@code`,\n            'dblp changed its JSON envelope or returned a partial error payload; inspect the raw response in a browser.',","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dblp/utils.js#L32-L68","documentation":"This error is thrown by dblpFetch when the dblp.org HTTP response has a non-ok status other than 429 and 404. It means the raw HTTP request itself failed with an unexpected status code (e.g. 500, 502, 403). The hint advises opening the same URL in a browser to inspect the response.","triggerScenarios":"dblpFetch receives res.ok === false with status not 429/404 — e.g. dblp returns 500/502 during an outage, a proxy/CDN returns 403, or a captive portal intercepts the request.","commonSituations":"dblp.org temporary outages or maintenance; corporate proxies or firewalls blocking dblp.org (403); Cloudflare-level errors (5xx) between the client and dblp.","solutions":["Open the same dblp URL in a browser to see the actual response/error page","Wait a few minutes and retry — most 5xx are transient dblp-side outages","Check whether a corporate proxy/firewall is blocking dblp.org (403) and whitelist it if needed","Check https://dblp.org status or the dblp FAQ for known incidents"],"exampleFix":"// before\nconst res = await fetch('https://dblp.org/search/publ/api?q=test&format=json');\n// (fails with \"dblp search returned HTTP 502\")\n// after\nawait new Promise(r => setTimeout(r, 3000)); // brief backoff for transient 5xx\nconst res = await fetch('https://dblp.org/search/publ/api?q=test&format=json');","handlingStrategy":"retry","validationCode":"const url = new URL('https://dblp.org/search/publ/api');\nif (!['https:'].includes(url.protocol)) throw new Error('dblp requires https');","typeGuard":"function isOkResponse(res) { return typeof res.status === 'number' && res.status >= 200 && res.status < 300; }","tryCatchPattern":"try {\n  const json = await dblpFetchJson(path, 'dblp search');\n} catch (err) {\n  if (/returned HTTP \\d+/.test(err.message) && !/429|404/.test(err.message)) {\n    // transient 5xx: back off and retry once or twice\n    await new Promise(r => setTimeout(r, 3000));\n    return retryFetch(path);\n  }\n  throw err;\n}","preventionTips":["Treat non-429/404 HTTP statuses as transient and implement bounded backoff retries","Check dblp.org reachability in a browser before blaming the client","Whitelist dblp.org on corporate proxies/firewalls","Monitor dblp status during known maintenance windows"],"tags":["http","network","dblp","api"],"backgroundTag":"http-unexpected-status","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}