{"record":{"id":"2c051a1933c7d7ce","repo":"jackwener/OpenCLI","slug":"network-failure-fetching-label-e-message","errorCode":null,"errorMessage":"Network failure fetching ${label}: ${e?.message ?? e}","messagePattern":"Network failure fetching (.+?): (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/openreview/utils.js","lineNumber":80,"sourceCode":"    const id = String(value ?? '').trim();\n    if (!id) {\n        throw new ArgumentError(`openreview ${label} is required`);\n    }\n    if (!PROFILE_ID_PATTERN.test(id)) {\n        throw new ArgumentError(`openreview ${label} \"${value}\" is not a valid profile id (expected \"~First_Last1\" or similar; find it on the author's openreview.net profile URL)`);\n    }\n    return id;\n}\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() : '';","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/openreview/utils.js#L62-L98","documentation":"openreviewFetch wraps all HTTP access to the OpenReview API and converts a fetch rejection (DNS failure, connection refused, TLS error, timeout) into a CommandExecutionError with a remediation hint. This guarantees network problems are never mistaken for empty results. The message includes the underlying error text for diagnosis.","triggerScenarios":"fetch() rejects while requesting ${OPENREVIEW_API}${path}: no internet, DNS outage, proxy/firewall blocking the API host, TLS interception, or the fetch timing out.","commonSituations":"Laptop offline or on captive-portal Wi-Fi; corporate proxy without NODE_EXTRA_CA_CERTS; VPN blocking the API host; DNS misconfiguration; OpenReview API temporarily unreachable.","solutions":["Verify network connectivity (curl https://api2.openreview.net) and retry.","Check proxy/VPN settings; set HTTPS_PROXY or NODE_EXTRA_CA_CERTS if behind a corporate proxy.","Check OpenReview status pages for an outage."],"exampleFix":"// before\nawait openreviewFetch(path, label) // throws on any network blip\n// after\nfor (let i = 0; i < 3; i++) {\n  try { return await openreviewFetch(path, label); }\n  catch (e) { if (i === 2 || !/Network failure/.test(e.message)) throw e; await sleep(2 ** i * 500); }\n}","handlingStrategy":"retry","validationCode":"import { execSync } from 'node:child_process';\ntry { execSync('curl -sf -m 5 https://api2.openreview.net', { stdio: 'ignore' }); } catch { console.error('OpenReview API unreachable'); process.exit(1); }","typeGuard":null,"tryCatchPattern":"try { return await openreviewFetch(path, label); }\ncatch (e) {\n  if (e instanceof CommandExecutionError && /Network failure/.test(e.message)) {\n    await new Promise(r => setTimeout(r, 2000));\n    return openreviewFetch(path, label); // one retry\n  }\n  throw e;\n}","preventionTips":["Check connectivity before bulk queries.","Configure proxy/TLS env vars (HTTPS_PROXY, NODE_EXTRA_CA_CERTS) in corporate networks.","Add exponential backoff retries around fetch calls.","Monitor OpenReview status for outages."],"tags":["network","fetch","connectivity"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}