{"record":{"id":"017ac5100caa8ac7","repo":"stablyai/orca","slug":"expected-a-positive-integer-got-rawvalue","errorCode":null,"errorMessage":"Expected a positive integer, got \"${rawValue}\".","messagePattern":"Expected a positive integer, got \"(.+?)\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/run-release-mac-build-workflow.mjs","lineNumber":206,"sourceCode":"  return null\n}\n\nfunction formatApiError(data) {\n  if (typeof data?.message === 'string') {\n    return data.message\n  }\n\n  return JSON.stringify(data)\n}\n\nfunction readPositiveInteger(rawValue, defaultValue) {\n  if (rawValue == null || rawValue === '') {\n    return defaultValue\n  }\n\n  const value = Number(rawValue)\n  if (!Number.isInteger(value) || value <= 0) {\n    throw new Error(`Expected a positive integer, got \"${rawValue}\".`)\n  }\n\n  return value\n}\n\nfunction requiredEnv(value, name) {\n  if (value == null || value === '') {\n    throw new Error(`${name} is required.`)\n  }\n\n  return value\n}\n\nfunction sleepMilliseconds(milliseconds) {\n  return new Promise((resolve) => {\n    setTimeout(resolve, milliseconds)\n  })\n}","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/run-release-mac-build-workflow.mjs#L188-L224","documentation":"Thrown by readPositiveInteger when an env value for a numeric release-build setting (RELEASE_MAC_BUILD_POLL_SECONDS or RELEASE_MAC_BUILD_TIMEOUT_MINUTES) is present but not a positive integer. Empty/null falls back to the default; any other value is parsed with Number() and must satisfy Number.isInteger(value) && value > 0.","triggerScenarios":"Setting RELEASE_MAC_BUILD_POLL_SECONDS=0, =-5, =1.5, =abc, or =30s. Number() yields a non-integer or non-positive value, failing the guard.","commonSituations":"Units included in the value ('30s'), decimals where integers are required, zero/negative mistaken as 'disabled', stray whitespace or quotes.","solutions":["Set the env var to a positive integer with no units (e.g. RELEASE_MAC_BUILD_POLL_SECONDS=30).","Leave it unset/empty to use the documented default (poll 30s, timeout 90m).","Strip units and whitespace before exporting."],"exampleFix":"# before\nRELEASE_MAC_BUILD_POLL_SECONDS=30s\n# after\nRELEASE_MAC_BUILD_POLL_SECONDS=30","handlingStrategy":"validation","validationCode":"function parsePositiveIntEnv(rawValue, defaultValue, name) {\n  if (rawValue == null || rawValue === '') return defaultValue\n  const value = Number(rawValue)\n  if (!Number.isInteger(value) || value <= 0) {\n    throw new Error(`${name} must be a positive integer, got \"${rawValue}\"`)\n  }\n  return value\n}","typeGuard":"function isPositiveIntegerString(value) {\n  return typeof value === 'string' && /^\\d+$/.test(value) && Number(value) > 0\n}","tryCatchPattern":"try {\n  options = readReleaseMacBuildWorkflowOptions(process.env)\n} catch (err) {\n  if (/Expected a positive integer/.test(err.message)) {\n    // list the offending env var and acceptable values\n    process.exit(2)\n  }\n  throw err\n}","preventionTips":["Document which env vars accept positive integers and their defaults.","Reject units/whitespace at the source (strip in shell, not in code).","Leave numeric env vars unset to use safe defaults rather than passing 0."],"tags":["config","validation","environment","numbers","release"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}