{"record":{"id":"db3d2e02fc9a78fa","repo":"stablyai/orca","slug":"name-must-be-a-positive-integer-received-val-db3d2e","errorCode":null,"errorMessage":"${name} must be a positive integer, received ${value}","messagePattern":"(.+?) must be a positive integer, received (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/repo-owner-settings-selector-benchmark.mjs","lineNumber":50,"sourceCode":"  const fields = block[1].match(/^\\s{2}\\w+\\??:/gm) ?? []\n  if (fields.length < 50) {\n    throw new Error(`GlobalSettings parsed as only ${fields.length} fields; re-sync this benchmark`)\n  }\n  return fields.length\n}\n\nconst SETTINGS_FIELDS = countGlobalSettingsFields(TYPES_SOURCE)\nconst ROWS = Number.parseInt(process.env.ORCA_OWNER_SETTINGS_BENCH_ROWS ?? '43', 10)\nconst WRITES = Number.parseInt(process.env.ORCA_OWNER_SETTINGS_BENCH_WRITES ?? '2000', 10)\nconst WARMUP = Number.parseInt(process.env.ORCA_OWNER_SETTINGS_BENCH_WARMUP ?? '200', 10)\n\nfor (const [name, value] of [\n  ['ORCA_OWNER_SETTINGS_BENCH_ROWS', ROWS],\n  ['ORCA_OWNER_SETTINGS_BENCH_WRITES', WRITES],\n  ['ORCA_OWNER_SETTINGS_BENCH_WARMUP', WARMUP]\n]) {\n  if (!Number.isInteger(value) || value <= 0) {\n    throw new Error(`${name} must be a positive integer, received ${value}`)\n  }\n}\n\nfunction makeSettings() {\n  const settings = { activeRuntimeEnvironmentId: 'focused-runtime' }\n  for (let index = 0; index < SETTINGS_FIELDS - 1; index += 1) {\n    settings[`field${index}`] = index % 3 === 0 ? `value-${index}` : index % 3 === 1 ? index : true\n  }\n  return settings\n}\n\nfunction makeRepos(rows) {\n  return Array.from({ length: rows }, (_value, index) => ({\n    id: `repo-${index}`,\n    connectionId: null,\n    executionHostId: `runtime:env-${index % 4}`\n  }))\n}","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/repo-owner-settings-selector-benchmark.mjs#L32-L68","documentation":"Thrown by the owner-settings selector benchmark when one of ORCA_OWNER_SETTINGS_BENCH_ROWS, BENCH_WRITES, or BENCH_WARMUP is set to a non-positive or non-integer value. The benchmark allocates fixture arrays sized by these, so zero/negative would produce degenerate arrays and NaN would corrupt timing.","triggerScenarios":"Setting any of the three env vars to 0, a negative number, or a non-numeric string. Number.parseInt('abc', 10) yields NaN, and Number.isInteger(NaN) is false.","commonSituations":"A developer sets WRITES=0 to run a quick test, or passes a decimal like 2000.5 (parseInt truncates but the check still passes since 2000 is an integer — however a purely non-numeric string fails).","solutions":["Omit all three env vars to use the defaults (ROWS=43, WRITES=2000, WARMUP=200).","Set each to a positive integer, e.g. ORCA_OWNER_SETTINGS_BENCH_WRITES=5000."],"exampleFix":"// before\nORCA_OWNER_SETTINGS_BENCH_WRITES=0 node config/scripts/repo-owner-settings-selector-benchmark.mjs\n// after\nORCA_OWNER_SETTINGS_BENCH_WRITES=5000 node config/scripts/repo-owner-settings-selector-benchmark.mjs","handlingStrategy":"validation","validationCode":"function readPositiveInt(name, fallback) {\n  const value = Number.parseInt(process.env[name] ?? String(fallback), 10)\n  if (!Number.isInteger(value) || value <= 0) {\n    throw new Error(`${name} must be a positive integer, received ${value}`)\n  }\n  return value\n}","typeGuard":"function isPositiveInt(value) {\n  return Number.isInteger(value) && value > 0\n}","tryCatchPattern":null,"preventionTips":["Validate all env vars in a single loop (as the script does) so the first bad value surfaces before any allocation.","Document defaults prominently in the script header."],"tags":["benchmark","env-var","validation","settings-selector"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}