abhigyanpatwari/GitNexus · error
${flag} is too large
Error message
${flag} is too large What it means
A positive-integer wiki option parses successfully but its value, multiplied by the flag's unit multiplier, exceeds Math.floor(Number.MAX_SAFE_INTEGER / multiplier). This guards against integer overflow before the value reaches downstream timeout/concurrency logic. The `flag` placeholder names the offending CLI flag.
Source
Thrown at gitnexus/src/cli/wiki.ts:61
timeout?: string;
retries?: string;
lang?: string;
allowInsecureConnection?: string;
}
function parsePositiveIntegerOption(
value: string | undefined,
flag: string,
multiplier = 1,
): number | undefined {
if (value === undefined) return undefined;
const trimmed = value.trim();
if (!/^[1-9]\d*$/.test(trimmed)) {
throw new Error(`${flag} must be a positive integer`);
}
const parsed = parseInt(trimmed, 10);
if (parsed > Math.floor(Number.MAX_SAFE_INTEGER / multiplier)) {
throw new Error(`${flag} is too large`);
}
return parsed;
}
function isLocalProvider(
provider: LLMProvider | undefined,
): provider is 'cursor' | 'claude' | 'codex' | 'opencode' {
return (
provider === 'cursor' ||
provider === 'claude' ||
provider === 'codex' ||
provider === 'opencode'
);
}
function localModelConfigKey(provider: 'cursor' | 'claude' | 'codex' | 'opencode') {
if (provider === 'cursor') return 'cursorModel';
if (provider === 'claude') return 'claudeModel';View on GitHub (pinned to d540b00184)
Solutions
- Use a smaller value within the JavaScript safe-integer range (<= 2^53 - 1).
- Confirm the flag's documented unit (seconds vs milliseconds) and pass a sensible magnitude.
- Bound the variable in any wrapper script before forwarding it to the CLI.
Example fix
# before gitnexus wiki --timeout 9000000000000000000 # after gitnexus wiki --timeout 300
Defensive patterns
Strategy: validation
Validate before calling
function safePositiveInt(value, flag, multiplier = 1) {
if (!/^[1-9]\d*$/.test(value)) throw new Error(flag + ' must be a positive integer');
const n = parseInt(value, 10);
if (n > Math.floor(Number.MAX_SAFE_INTEGER / multiplier)) {
throw new Error(flag + ' is too large');
}
return n;
} Prevention
- Keep values well within 2^53 - 1.
- Confirm the documented unit (seconds vs ms) before passing large magnitudes.
When it happens
Trigger: `gitnexus wiki --timeout 99999999999999999999` (seconds or ms depending on the flag) far beyond the safe integer range.
Common situations: Misplaced units (e.g. passing nanoseconds into a millisecond field); copy-paste of a huge sentinel; a script interpolating an unbounded variable.
Related errors
- ${flag} must be a positive integer
- Malformed --shard arg '${malformed}' — expected --shard=<ind
- ${source} must be a finite number.
- ${source} must be a number or numeric string.
- --branch "${options.branch}" does not match the checked-out
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/00a842e2bcb88781.
Report an issue: GitHub.