jackwener/OpenCLI · error · EmptyResultError

IETF datatracker returned 404 for ${url}.

Error message

IETF datatracker returned 404 for ${url}.

What it means

rfcFetch translates an HTTP 404 from the IETF datatracker into EmptyResultError, indicating no document exists at the requested URL. This distinguishes 'not found' from genuine network or server errors.

Source

Thrown at clis/rfc/utils.js:46

    if (n > 999999) {
        throw new ArgumentError('rfc number must be <= 999999');
    }
    return n;
}

export async function rfcFetch(url, label) {
    let resp;
    try {
        resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });
    }
    catch (err) {
        throw new CommandExecutionError(
            `${label} request failed: ${err?.message ?? err}`,
            'Check that datatracker.ietf.org is reachable from this network.',
        );
    }
    if (resp.status === 404) {
        throw new EmptyResultError(label, `IETF datatracker returned 404 for ${url}.`);
    }
    if (resp.status === 429) {
        throw new CommandExecutionError(`${label} returned HTTP 429 (rate limited)`);
    }
    if (!resp.ok) {
        throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);
    }
    let body;
    try {
        body = await resp.json();
    }
    catch (err) {
        throw new CommandExecutionError(`${label} returned malformed JSON: ${err?.message ?? err}`);
    }
    return body;
}

// IETF datatracker timestamps are like "2022-02-19 08:46:51" (no T, no Z)

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the RFC number exists on datatracker.ietf.org before fetching.
  2. Correct typos in the requested number.
  3. Catch EmptyResultError and show 'RFC not found' instead of a generic error.
  4. If a URL pattern changed, update RFC_BASE usage to the current datatracker API.

Example fix

// before
rfc rfc --number 99999   // 404
// after
rfc rfc --number 9000
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate the RFC exists in a local index
const knownRfcs = new Set([791, 2616, 9000]);
if (!knownRfcs.has(n)) console.warn(`RFC ${n} may not exist`);

Type guard

null

Try / catch

try {
  const doc = await rfcFetch(url, label);
} catch (err) {
  if (err instanceof EmptyResultError) {
    console.error(`RFC not found: ${url}`);
  } else throw err;
}

Prevention

When it happens

Trigger: Requesting doc.json for an RFC number that does not exist (e.g. rfc99999), a mistyped number, or a name that maps to no datatracker document.

Common situations: Typos in RFC numbers, querying numbers reserved but never published, or stale scripts referencing restructured datatracker URLs.

Related errors


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