{"record":{"id":"00a842e2bcb88781","repo":"abhigyanpatwari/GitNexus","slug":"flag-is-too-large","errorCode":null,"errorMessage":"${flag} is too large","messagePattern":"(.+?) is too large","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/wiki.ts","lineNumber":61,"sourceCode":"  timeout?: string;\n  retries?: string;\n  lang?: string;\n  allowInsecureConnection?: string;\n}\n\nfunction parsePositiveIntegerOption(\n  value: string | undefined,\n  flag: string,\n  multiplier = 1,\n): number | undefined {\n  if (value === undefined) return undefined;\n  const trimmed = value.trim();\n  if (!/^[1-9]\\d*$/.test(trimmed)) {\n    throw new Error(`${flag} must be a positive integer`);\n  }\n  const parsed = parseInt(trimmed, 10);\n  if (parsed > Math.floor(Number.MAX_SAFE_INTEGER / multiplier)) {\n    throw new Error(`${flag} is too large`);\n  }\n  return parsed;\n}\n\nfunction isLocalProvider(\n  provider: LLMProvider | undefined,\n): provider is 'cursor' | 'claude' | 'codex' | 'opencode' {\n  return (\n    provider === 'cursor' ||\n    provider === 'claude' ||\n    provider === 'codex' ||\n    provider === 'opencode'\n  );\n}\n\nfunction localModelConfigKey(provider: 'cursor' | 'claude' | 'codex' | 'opencode') {\n  if (provider === 'cursor') return 'cursorModel';\n  if (provider === 'claude') return 'claudeModel';","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/cli/wiki.ts#L43-L79","documentation":"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.","triggerScenarios":"`gitnexus wiki --timeout 99999999999999999999` (seconds or ms depending on the flag) far beyond the safe integer range.","commonSituations":"Misplaced units (e.g. passing nanoseconds into a millisecond field); copy-paste of a huge sentinel; a script interpolating an unbounded variable.","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."],"exampleFix":"# before\ngitnexus wiki --timeout 9000000000000000000\n# after\ngitnexus wiki --timeout 300","handlingStrategy":"validation","validationCode":"function safePositiveInt(value, flag, multiplier = 1) {\n  if (!/^[1-9]\\d*$/.test(value)) throw new Error(flag + ' must be a positive integer');\n  const n = parseInt(value, 10);\n  if (n > Math.floor(Number.MAX_SAFE_INTEGER / multiplier)) {\n    throw new Error(flag + ' is too large');\n  }\n  return n;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep values well within 2^53 - 1.","Confirm the documented unit (seconds vs ms) before passing large magnitudes."],"tags":["wiki","cli","validation","numeric","overflow"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}