{"record":{"id":"bd507ee2688faa88","repo":"paperclipai/paperclip","slug":"label-must-be-an-integer-between-1-and-maximu","errorCode":null,"errorMessage":"${label} must be an integer between 1 and ${maximum}.","messagePattern":"(.+?) must be an integer between 1 and (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/codex-local/src/ui/build-config.ts","lineNumber":132,"sourceCode":"  );\n  const managedAgentsRetentionAcknowledged =\n    schemaValues.managedAgentsRetentionAcknowledged === true;\n  const agentCoreRetentionAcknowledged =\n    schemaValues.agentCoreRetentionAcknowledged === true;\n  const boundedLimit = (\n    value: unknown,\n    fallback: number,\n    maximum: number,\n    label: string,\n  ) => {\n    if (value === undefined || value === null || value === \"\") return fallback;\n    if (\n      typeof value !== \"number\"\n      || !Number.isSafeInteger(value)\n      || value <= 0\n      || value > maximum\n    ) {\n      throw new Error(`${label} must be an integer between 1 and ${maximum}.`);\n    }\n    return value;\n  };\n  const maxIterations = boundedLimit(\n    schemaValues.maxIterations,\n    8,\n    8,\n    \"AWS AgentCore maxIterations\",\n  );\n  const maxOutputTokens = boundedLimit(\n    schemaValues.maxOutputTokens,\n    4_096,\n    4_096,\n    \"AWS AgentCore maxOutputTokens\",\n  );\n  const timeoutSeconds = boundedLimit(\n    schemaValues.timeoutSeconds,\n    300,","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/adapters/codex-local/src/ui/build-config.ts#L114-L150","documentation":"boundedLimit validates AWS AgentCore numeric limits in the Codex adapter config UI. A value must be absent/empty (fallback applied) or a positive safe integer not exceeding the per-field maximum (maxIterations ≤ 8, maxOutputTokens ≤ 4096, timeoutSeconds ≤ 300). Anything else — strings, floats, zero, negatives, over-max — throws with a labeled message naming the field and bound.","triggerScenarios":"Saving adapter config where schemaValues.maxIterations, maxOutputTokens, or timeoutSeconds is a non-number (e.g. \"8\" as a string from a form), a float (250.5), 0, negative, or above the cap (e.g. timeoutSeconds: 600, maxIterations: 12).","commonSituations":"Form inputs returning strings instead of numbers; pasting tuning values from AgentCore docs that exceed Paperclip's tighter caps; JSON hand-edits with decimal or negative values; forgetting to clear a field so it stays \"\" is fine, but whitespace or 0 is not.","solutions":["Set the field to a positive integer within its cap: maxIterations 1–8, maxOutputTokens 1–4096, timeoutSeconds 1–300.","Clear the field (undefined/null/empty string) to accept the built-in fallback (8 / 4096 / 300).","Coerce form input with Number(...) and Number.isInteger before saving config.","If you need higher limits, raise them in the adapter code — the caps are enforced client-side by design."],"exampleFix":"// before\nconfig.timeoutSeconds = \"600\";      // string, over cap\n// after\nconfig.timeoutSeconds = 300;        // positive integer within max 300 (or omit for default)","handlingStrategy":"validation","validationCode":"function bounded(value, max) {\n  if (value === undefined || value === null || value === \"\") return null; // use fallback\n  const n = Number(value);\n  if (!Number.isSafeInteger(n) || n <= 0 || n > max) {\n    throw new RangeError(`expected integer 1..${max}, got ${JSON.stringify(value)}`);\n  }\n  return n;\n}\nbounded(form.maxIterations, 8);\nbounded(form.maxOutputTokens, 4096);\nbounded(form.timeoutSeconds, 300);","typeGuard":"function isBoundedInt(v: unknown, max: number): v is number {\n  return typeof v === \"number\" && Number.isSafeInteger(v) && v > 0 && v <= max;\n}","tryCatchPattern":"try {\n  const config = buildConfig(rawValues);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"must be an integer between 1 and\")) {\n    showFormError(e.message); // surface field-level message in the UI, keep other fields\n  } else throw e;\n}","preventionTips":["Use <input type=\"number\" min=\"1\" max=\"{cap}\" step=\"1\"> for these fields.","Coerce form values with Number() before persisting config.","Remember the caps: maxIterations 8, maxOutputTokens 4096, timeoutSeconds 300.","Leave fields empty to get defaults (8 / 4096 / 300) instead of entering 0."],"tags":["validation","configuration","integer-bounds","agentcore"],"backgroundTag":"invalid-config-value","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}