{"record":{"id":"288b825f4c9708a8","repo":"can1357/oh-my-pi","slug":"limit-must-be-a-positive-number","errorCode":null,"errorMessage":"Limit must be a positive number.","messagePattern":"Limit must be a positive number\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/coding-agent/src/modes/components/settings-selector.ts","lineNumber":484,"sourceCode":"\n\t#showProviderEditor(provider: string): void {\n\t\tconst limits = normalizeProviderMaxInFlightRequests(settings.get(\"providers.maxInFlightRequests\"));\n\t\tthis.clear();\n\t\tthis.#selectList = undefined;\n\t\tthis.addChild(\n\t\t\tnew TextInputSubmenu(\n\t\t\t\t`Max In-Flight Requests: ${provider}`,\n\t\t\t\t\"Enter a positive number. Decimals round down. Clear the field to make this provider unlimited.\",\n\t\t\t\tlimits[provider]?.toString() ?? \"\",\n\t\t\t\tfalse,\n\t\t\t\tvalue => {\n\t\t\t\t\tconst next = { ...limits };\n\t\t\t\t\tconst trimmed = value.trim();\n\t\t\t\t\tif (trimmed === \"\") {\n\t\t\t\t\t\tdelete next[provider];\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst limit = Number(trimmed);\n\t\t\t\t\t\tif (!Number.isFinite(limit) || limit <= 0) throw new Error(\"Limit must be a positive number.\");\n\t\t\t\t\t\tnext[provider] = Math.max(1, Math.floor(limit));\n\t\t\t\t\t}\n\t\t\t\t\tconst normalized = validateProviderMaxInFlightRequests(next);\n\t\t\t\t\tsettings.set(\"providers.maxInFlightRequests\", normalized);\n\t\t\t\t\tthis.onChange(normalized);\n\t\t\t\t\tthis.#showProviderList();\n\t\t\t\t\tthis.requestRender?.();\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tthis.#showProviderList();\n\t\t\t\t\tthis.requestRender?.();\n\t\t\t\t},\n\t\t\t),\n\t\t);\n\t}\n\n\thandleInput(data: string): void {\n\t\tif (this.#selectList) {","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/modes/components/settings-selector.ts#L466-L502","documentation":"In the provider editor for providers.maxInFlightRequests, each per-provider limit must be a finite number greater than 0. Empty input deletes the provider's entry (inheriting the default); anything else that is NaN, Infinity, or <= 0 throws this error and the edit is rejected.","triggerScenarios":"Typing a non-numeric or non-positive value (e.g. 'abc', '-3', '0', '1e999') into the per-provider in-flight-request limit field in #showProviderEditor.","commonSituations":"Typo when editing the limit; attempting to disable a provider by entering 0 (instead of clearing the field); paste with units ('10 req'); locale decimal comma parsed as NaN.","solutions":["Enter a positive number (decimals are floored, minimum enforced value is 1)","Clear the field entirely to remove the per-provider override and use the default","Use '1' or higher for throttling instead of 0","Edit the raw JSON record value via the record editor with valid JSON like {\"anthropic\": 4}"],"exampleFix":"// before\nlimit input: \"0\"  -> throws\n// after\nlimit input: \"\"   (remove override) or \"4\" (valid limit)","handlingStrategy":"validation","validationCode":"const limit = Number(value.trim());\nif (value.trim() !== \"\" && (!Number.isFinite(limit) || limit <= 0)) {\n  throw new Error(\"Limit must be a positive number\");\n}","typeGuard":"function isValidLimit(v: string): boolean {\n  const t = v.trim();\n  if (t === \"\") return true;\n  const n = Number(t);\n  return Number.isFinite(n) && n > 0;\n}","tryCatchPattern":"try {\n  editor.setProviderLimit(value);\n} catch (err) {\n  if (err instanceof Error && err.message === \"Limit must be a positive number.\") {\n    // re-prompt for a positive number or clear to remove the override\n  } else throw err;\n}","preventionTips":["Only enter plain positive numbers (no units, no 0)","Clear the field to remove an override rather than entering 0","Use '.' as the decimal separator","Validate numeric inputs before submitting"],"tags":["validation","settings","user-input"],"backgroundTag":"invalid-numeric-input","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}