{"record":{"id":"c1ed35c53d9f3e6b","repo":"abhigyanpatwari/GitNexus","slug":"flag-must-not-exceed-maximum-c1ed35","errorCode":null,"errorMessage":"${flag} must not exceed ${maximum}","messagePattern":"(.+?) must not exceed (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/cli/analyze-watch.ts","lineNumber":92,"sourceCode":"  readonly verbose: string | undefined;\n}\n\nfunction setEnvironment(name: string, value: string | undefined): void {\n  if (value === undefined) delete process.env[name];\n  else process.env[name] = value;\n}\n\nfunction positiveInteger(\n  value: string | undefined,\n  flag: string,\n  maximum?: number,\n): number | undefined {\n  if (value === undefined) return undefined;\n  const parsed = Number(value);\n  if (!Number.isInteger(parsed) || parsed < 1)\n    throw new Error(`${flag} must be a positive integer`);\n  if (maximum !== undefined && parsed > maximum) {\n    throw new Error(`${flag} must not exceed ${maximum}`);\n  }\n  return parsed;\n}\n\nexport async function resolveWatchOptions(\n  repoPath: string,\n  cli: WatchCliOptions,\n  baseline: WatchEnvironmentBaseline,\n  reportIgnoredConfig: (names: readonly string[]) => void = () => {},\n): Promise<CoreAnalyzeOptions> {\n  const config = (await loadAnalyzeConfigStrict(repoPath)) ?? {};\n  const merged = mergeAnalyzeOptions(cli, config);\n  const unsupported = [\n    ['--force', cli.force],\n    ['--no-parse-cache', cli.parseCache === false],\n    ['--repair-fts', cli.repairFts],\n    ['--embeddings', cli.embeddings],\n    ['--drop-embeddings', cli.dropEmbeddings],","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/cli/analyze-watch.ts#L74-L110","documentation":"positiveInteger() also enforces an optional upper bound: when the caller passes a `maximum`, any parsed integer above it is rejected with '<flag> must not exceed <maximum>'. It exists to cap resource-consuming watch options (e.g. worker pool size) at safe limits.","triggerScenarios":"Calling a watch-related flag whose value parses to a valid positive integer but is greater than the caller-declared maximum (e.g. --worker-pool-size 1000 when the cap is lower).","commonSituations":"Inflating worker pool size on a small machine, guessing a timeout in the wrong unit (milliseconds vs seconds) producing an enormous number, or scripting a default that exceeds the cap.","solutions":["Lower the flag value to at most the stated maximum in the message.","Read `gitnexus analyze --watch --help` for the documented cap for each numeric option.","If you genuinely need a higher value, run the non-watch `analyze` path or file an issue to raise the cap.","Clamp the value in your wrapper script before invoking the CLI."],"exampleFix":"// before\ngitnexus analyze --watch --worker-pool-size 512\n// after\ngitnexus analyze --watch --worker-pool-size 8","handlingStrategy":"validation","validationCode":"const MAX_WORKER_POOL_SIZE = 64; // check --help for the actual cap\nconst n = Number(opts.workerPoolSize);\nif (n > MAX_WORKER_POOL_SIZE) opts.workerPoolSize = MAX_WORKER_POOL_SIZE;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp numeric options to documented maxima in wrapper scripts","Check --help for per-flag caps before scripting large values","Watch for unit confusion (ms vs seconds) inflating values"],"tags":["cli","validation","numeric-argument","limit"],"backgroundTag":"value-out-of-range","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}