{"record":{"id":"545d96be388d1665","repo":"jackwener/OpenCLI","slug":"nvd-cve-request-failed-err-message-err","errorCode":null,"errorMessage":"nvd cve request failed: ${err?.message ?? err}","messagePattern":"nvd cve request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/nvd/cve.js","lineNumber":76,"sourceCode":"    domain: 'services.nvd.nist.gov',\n    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'id', positional: true, required: true, help: 'CVE identifier (e.g. \"CVE-2021-44228\")' },\n    ],\n    columns: [\n        'id', 'published', 'lastModified', 'vulnStatus', 'baseScore', 'severity',\n        'attackVector', 'cwe', 'kevAdded', 'description', 'url',\n    ],\n    func: async (args) => {\n        const id = requireCveId(args.id);\n        const url = `${NVD_BASE}?cveId=${encodeURIComponent(id)}`;\n        let resp;\n        try {\n            resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });\n        }\n        catch (err) {\n            throw new CommandExecutionError(`nvd cve request failed: ${err?.message ?? err}`);\n        }\n        if (resp.status === 403) {\n            throw new CommandExecutionError(\n                'nvd cve returned HTTP 403',\n                'NVD enforces aggressive rate limits without an API key. Wait, then retry or set NVD_API_KEY (not yet wired).',\n            );\n        }\n        if (resp.status === 429) {\n            throw new CommandExecutionError(\n                'nvd cve returned HTTP 429 (rate limited)',\n                'NVD throttles unauthenticated traffic; wait several seconds before retry.',\n            );\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`nvd cve returned HTTP ${resp.status}`);\n        }\n        let body;\n        try {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/nvd/cve.js#L58-L94","documentation":"This CommandExecutionError wraps any network-level failure of the fetch() call to the NVD API (https://services.nvd.nist.gov/...?cveId=...). It fires when the HTTP request itself fails — DNS resolution, connection refused/reset, TLS errors, or request aborts — not when NVD returns a bad HTTP status. The original error message is embedded for diagnosis.","triggerScenarios":"fetch() rejects while requesting `${NVD_BASE}?cveId=<id>` with a user-agent header: offline machine, DNS failure, firewall/proxy blocking services.nvd.nist.gov, TLS interception, or an abort/timeout during the request.","commonSituations":"Corporate proxies blocking the NVD domain, intermittent DNS problems, running in a container with no egress, or IPv6 misconfiguration on the host.","solutions":["Check network connectivity and confirm you can reach services.nvd.nist.gov (e.g. curl -I the API URL).","Configure HTTP(S)_PROXY / egress rules if a corporate proxy or firewall is in the path.","Retry after a short wait — many failures are transient.","Inspect the embedded inner message for the root cause (ENOTFOUND, ECONNREFUSED, certificate errors)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const reachable = await fetch('https://services.nvd.nist.gov', { method: 'HEAD' }).then(r => r.ok || r.status < 500).catch(() => false);\nif (!reachable) console.warn('NVD appears unreachable');","typeGuard":null,"tryCatchPattern":"try { return await nvdCve(id); } catch (e) { if (/nvd cve request failed/.test(e.message)) return retryWithBackoff(() => nvdCve(id), 3); throw e; }","preventionTips":["Configure proxy env vars correctly in corporate environments.","Verify egress to services.nvd.nist.gov from CI containers.","Wrap outbound NVD calls in retry-with-backoff from day one."],"tags":["network","fetch-failed","nvd","http"],"backgroundTag":"fetch-network-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}