jackwener/OpenCLI · error · CommandExecutionError

nvd cve request failed: ${err?.message ?? err}

Error message

nvd cve request failed: ${err?.message ?? err}

What it means

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.

Source

Thrown at clis/nvd/cve.js:76

    domain: 'services.nvd.nist.gov',
    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        { name: 'id', positional: true, required: true, help: 'CVE identifier (e.g. "CVE-2021-44228")' },
    ],
    columns: [
        'id', 'published', 'lastModified', 'vulnStatus', 'baseScore', 'severity',
        'attackVector', 'cwe', 'kevAdded', 'description', 'url',
    ],
    func: async (args) => {
        const id = requireCveId(args.id);
        const url = `${NVD_BASE}?cveId=${encodeURIComponent(id)}`;
        let resp;
        try {
            resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });
        }
        catch (err) {
            throw new CommandExecutionError(`nvd cve request failed: ${err?.message ?? err}`);
        }
        if (resp.status === 403) {
            throw new CommandExecutionError(
                'nvd cve returned HTTP 403',
                'NVD enforces aggressive rate limits without an API key. Wait, then retry or set NVD_API_KEY (not yet wired).',
            );
        }
        if (resp.status === 429) {
            throw new CommandExecutionError(
                'nvd cve returned HTTP 429 (rate limited)',
                'NVD throttles unauthenticated traffic; wait several seconds before retry.',
            );
        }
        if (!resp.ok) {
            throw new CommandExecutionError(`nvd cve returned HTTP ${resp.status}`);
        }
        let body;
        try {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and confirm you can reach services.nvd.nist.gov (e.g. curl -I the API URL).
  2. Configure HTTP(S)_PROXY / egress rules if a corporate proxy or firewall is in the path.
  3. Retry after a short wait — many failures are transient.
  4. Inspect the embedded inner message for the root cause (ENOTFOUND, ECONNREFUSED, certificate errors).
Defensive patterns

Strategy: retry

Validate before calling

const reachable = await fetch('https://services.nvd.nist.gov', { method: 'HEAD' }).then(r => r.ok || r.status < 500).catch(() => false);
if (!reachable) console.warn('NVD appears unreachable');

Try / catch

try { return await nvdCve(id); } catch (e) { if (/nvd cve request failed/.test(e.message)) return retryWithBackoff(() => nvdCve(id), 3); throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: Corporate proxies blocking the NVD domain, intermittent DNS problems, running in a container with no egress, or IPv6 misconfiguration on the host.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/545d96be388d1665. Report an issue: GitHub.