{"record":{"id":"88b382fc1aa22cf9","repo":"abhigyanpatwari/GitNexus","slug":"name-must-be-a-positive-integer-max-got","errorCode":null,"errorMessage":"${name} must be a positive integer <= ${max}, got \"${raw}\"","messagePattern":"(.+?) must be a positive integer <= (.+?), got \"(.+?)\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/embeddings/http-client.ts","lineNumber":60,"sourceCode":"  requestDimensions?: number;\n}\n\nexport interface EmbeddingRequestOptions {\n  signal?: AbortSignal;\n}\n\nlet lastHttpRequestStartedAt: number | undefined;\nlet httpPaceQueue: Promise<void> = Promise.resolve();\n\nconst parsePositiveIntegerEnv = (name: string, fallback: number, max: number): number => {\n  const raw = process.env[name];\n  if (raw === undefined || raw === '') return fallback;\n  if (!/^\\d+$/u.test(raw)) {\n    throw new Error(`${name} must be a positive integer, got \"${raw}\"`);\n  }\n  const parsed = Number(raw);\n  if (!Number.isSafeInteger(parsed) || parsed <= 0 || parsed > max) {\n    throw new Error(`${name} must be a positive integer <= ${max}, got \"${raw}\"`);\n  }\n  return parsed;\n};\n\nconst parseNonNegativeIntegerEnv = (name: string, fallback: number, max: number): number => {\n  const raw = process.env[name];\n  if (raw === undefined || raw === '') return fallback;\n  if (!/^\\d+$/u.test(raw)) {\n    throw new Error(`${name} must be a non-negative integer, got \"${raw}\"`);\n  }\n  const parsed = Number(raw);\n  if (!Number.isSafeInteger(parsed) || parsed < 0 || parsed > max) {\n    throw new Error(`${name} must be a non-negative integer <= ${max}, got \"${raw}\"`);\n  }\n  return parsed;\n};\n\nconst cancelledError = (): DOMException =>","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/embeddings/http-client.ts#L42-L78","documentation":"Thrown by parsePositiveIntegerEnv() in http-client.ts when the value passes the digits-only regex but Number(raw) is not a safe integer, is <= 0, or exceeds the per-variable max. Each variable has its own ceiling: GITNEXUS_EMBEDDING_MAX_ATTEMPTS ≤ 20, GITNEXUS_EMBEDDING_RETRY_CAP_MS ≤ 300000, GITNEXUS_EMBEDDING_HTTP_TIMEOUT_MS ≤ MAX_HTTP_TIMEOUT_MS (300000). The ceiling prevents runaway retry/timeout configs that would hang the embedding pipeline.","triggerScenarios":"readConfig() at http-client.ts:189-204. Fires on e.g. GITNEXUS_EMBEDDING_MAX_ATTEMPTS=0, =999, GITNEXUS_EMBEDDING_RETRY_CAP_MS=1000000, GITNEXUS_EMBEDDING_HTTP_TIMEOUT_MS=9999999. A value exceeding Number.MAX_SAFE_INTEGER would also fail the Number.isSafeInteger guard.","commonSituations":"Setting a very large retry cap or timeout thinking higher is safer; setting attempts to 0 to disable retries (use 1 instead); a computed value that overflowed into an unsafe integer.","solutions":["Set the variable within its documented ceiling (max attempts ≤ 20, retry cap ≤ 300000ms, timeout ≤ 300000ms).","Set GITNEXUS_EMBEDDING_MAX_ATTEMPTS=1 to disable retries rather than 0.","Unset the variable to accept the default, which is already within bounds."],"exampleFix":"# before\nexport GITNEXUS_EMBEDDING_MAX_ATTEMPTS=100\n# after\nexport GITNEXUS_EMBEDDING_MAX_ATTEMPTS=20  # the ceiling","handlingStrategy":"validation","validationCode":"const CEILINGS = {\n  GITNEXUS_EMBEDDING_MAX_ATTEMPTS: 20,\n  GITNEXUS_EMBEDDING_RETRY_CAP_MS: 300_000,\n  GITNEXUS_EMBEDDING_HTTP_TIMEOUT_MS: 300_000,\n} as const;\nfor (const [name, max] of Object.entries(CEILINGS)) {\n  const v = process.env[name];\n  if (v === undefined) continue;\n  const n = Number(v);\n  if (!Number.isSafeInteger(n) || n <= 0 || n > max) {\n    throw new Error(`${name} must be a positive integer <= ${max}; got \\\"${v}\\\"`);\n  }\n}","typeGuard":"const isWithinPositiveCeiling = (v: string, max: number): boolean => {\n  const n = Number(v);\n  return Number.isSafeInteger(n) && n > 0 && n <= max;\n};","tryCatchPattern":null,"preventionTips":["Respect each variable's ceiling: attempts ≤ 20, retry cap ≤ 300000ms, timeout ≤ 300000ms.","Set MAX_ATTEMPTS=1 (not 0) to disable retries.","Unset a variable to accept its default rather than pushing past the cap."],"tags":["config","env-var","embeddings","http-mode","validation","bounds"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}