jackwener/OpenCLI · error · ArgumentError
rfc number must be <= 999999
Error message
rfc number must be <= 999999
What it means
requireRfcNumber caps RFC numbers at 999999 to guard against absurd inputs and malformed requests to the datatracker API. Values above this limit throw ArgumentError immediately, before any network call.
Source
Thrown at clis/rfc/utils.js:29
export function requireRfcNumber(value) {
const raw = value;
if (raw == null || String(raw).trim() === '') {
throw new ArgumentError(
'rfc number is required (e.g. 9000, 791, 2616)',
'Pass the integer RFC number; do not include the "rfc" prefix.',
);
}
// Accept "9000" or 9000 or "rfc9000" as a courtesy.
const s = String(raw).trim().toLowerCase().replace(/^rfc/, '');
const n = Number.parseInt(s, 10);
if (!Number.isInteger(n) || n <= 0 || String(n) !== s) {
throw new ArgumentError(
`rfc number "${value}" is not a valid RFC number`,
'Pass a positive integer (e.g. 9000, 791, 2616).',
);
}
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}.`);
}View on GitHub (pinned to 49907e53dc)
Solutions
- Use an RFC number of 999999 or less — real RFCs are far below this.
- Remove duplicated digits or concatenated values from the input.
- Confirm the number against the RFC index if unsure.
- Catch ArgumentError to re-prompt with the documented bound.
Example fix
// before rfc rfc --number 1234567 // after rfc rfc --number 9000
Defensive patterns
Strategy: validation
Validate before calling
function rfcNumberWithinBounds(v, max = 999999) {
const n = Number(v);
return Number.isInteger(n) && n > 0 && n <= max;
}
if (!rfcNumberWithinBounds(input)) input = 9000; Type guard
const rfcInBounds = (v) => { const n = Number(v); return Number.isInteger(n) && n > 0 && n <= 999999; }; Try / catch
try {
const n = requireRfcNumber(input);
} catch (err) {
if (err instanceof ArgumentError && /<= 999999/.test(err.message)) {
console.error('RFC number too large; use the real RFC number.');
} else throw err;
} Prevention
- Bound-check user input in scripts before invoking the CLI.
- Avoid concatenating digits when building numbers from IDs.
- Only pass genuine RFC numbers — real ones are well under 10000 today.
- Log the offending value to spot systematic input corruption.
When it happens
Trigger: Passing --number with an integer > 999999, e.g. --number 1000000 or a padded/concatenated value like 'rfc1234567890'.
Common situations: Users concatenating numbers by mistake, testing with sentinel values like 99999999, or confusing RFC numbers with other document IDs (drafts, DOIs).
Related errors
- ${label} must be between ${min} and ${max}, got ${parsed}
- ${label} must be <= ${max}
- --${name} must be between ${min} and ${max}, got ${parsed}
- flomo memos --${name} must be between 1 and ${max}
- limit must be an integer between 1 and ${max}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/dc4421e818777980.
Report an issue: GitHub.