{"record":{"id":"071d603ba0dfc0d4","repo":"jackwener/OpenCLI","slug":"openreview-api-http-resp-status-for-label-b","errorCode":null,"errorMessage":"OpenReview API HTTP ${resp.status} for ${label}${body ? ` (${body})` : ''}","messagePattern":"OpenReview API HTTP (.+?) for (.+?)(.+?)\\)` : ''\\}","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/openreview/utils.js","lineNumber":88,"sourceCode":"}\n\n/** Wrap fetch + json with typed errors so failures never look like empty results. */\nexport async function openreviewFetch(path, label) {\n    const url = `${OPENREVIEW_API}${path}`;\n    let resp;\n    try {\n        resp = await fetch(url);\n    }\n    catch (e) {\n        throw new CommandExecutionError(`Network failure fetching ${label}: ${e?.message ?? e}`, 'Check your network connection and try again.');\n    }\n    if (resp.status === 404) {\n        return null;\n    }\n    if (!resp.ok) {\n        let body = '';\n        try { body = (await resp.text()).slice(0, 200); } catch {}\n        throw new CommandExecutionError(`OpenReview API HTTP ${resp.status} for ${label}${body ? ` (${body})` : ''}`, 'The OpenReview API may be down or rate-limiting.');\n    }\n    let json;\n    try {\n        json = await resp.json();\n    }\n    catch (e) {\n        throw new CommandExecutionError(`Malformed JSON from OpenReview for ${label}: ${e?.message ?? e}`, 'Try again or report this as an OpenReview API bug.');\n    }\n    const envelopeErrors = Array.isArray(json?.errors) ? json.errors.filter(Boolean) : [];\n    const envelopeError = typeof json?.error === 'string' ? json.error.trim() : '';\n    if (envelopeErrors.length || envelopeError) {\n        const detail = envelopeError || envelopeErrors.map((entry) => {\n            if (typeof entry === 'string') return entry;\n            if (entry?.message) return String(entry.message);\n            return JSON.stringify(entry);\n        }).join('; ');\n        throw new CommandExecutionError(`OpenReview API error for ${label}: ${detail}`, 'The OpenReview API returned an application-level error.');\n    }","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/openreview/utils.js#L70-L106","documentation":"openreviewFetch throws CommandExecutionError when the OpenReview API responds with a non-2xx status other than 404 (404 returns null to mean 'not found'). The message carries the HTTP status plus up to 200 chars of the response body. It indicates server-side rejection such as rate limiting or an API outage.","triggerScenarios":"The API returns 429 (rate limit), 5xx (server error), 401/403, or 400 for the request labeled '${label}'.","commonSituations":"Hammering the API in a loop exceeding rate limits; OpenReview API instability during conference review deadlines; an invalid id occasionally surfacing as 400 from the API.","solutions":["Wait and retry with backoff, especially for HTTP 429.","Reduce request rate or batch lookups; cache forum/profile results.","Check OpenReview status pages for ongoing incidents if 5xx persists."],"exampleFix":"// before\nconst json = await openreviewFetch(path, label);\n// after\ntry { var json = await openreviewFetch(path, label); }\ncatch (e) { if (/HTTP 429/.test(e.message)) { await sleep(5000); return openreviewFetch(path, label); } throw e; }","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const json = await openreviewFetch(path, label); }\ncatch (e) {\n  const m = /HTTP (\\d+)/.exec(e.message);\n  if (m && (m[1] === '429' || m[1].startsWith('5'))) { await sleep(5000); return openreviewFetch(path, label); }\n  throw e;\n}","preventionTips":["Throttle request rate to stay under OpenReview's limits.","Cache responses for repeated forum/profile lookups.","Use exponential backoff on 429/5xx.","Watch OpenReview status during conference deadline periods."],"tags":["http","api-error","rate-limit"],"backgroundTag":"http-5xx","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}