{"record":{"id":"c0b901c011d74080","repo":"stablyai/orca","slug":"orca-pty-bench-ingress-chars-must-be-positive-rec","errorCode":null,"errorMessage":"ORCA_PTY_BENCH_INGRESS_CHARS must be positive, received ${INGRESS_CHUNK_CHARS}","messagePattern":"ORCA_PTY_BENCH_INGRESS_CHARS must be positive, received (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/pty-batch-flush-benchmark.mjs","lineNumber":33,"sourceCode":"const MAX_TAIL_CHARS = 256 * 1024\nconst MAX_TAIL_PARTIAL_CHARS = 4000\nconst OSC_TITLE_RE = /\\x1b\\]([012]);([^\\x07\\x1b]*?)(?:\\x07|\\x1b\\\\)/g\nconst URL_CANDIDATE_PATTERN = /\\bhttps?:\\/\\/[^\\s<>\"'`]+/gi\n\nif (!Number.isInteger(PTY_COUNT) || PTY_COUNT <= 0) {\n  throw new Error(`ORCA_PTY_BENCH_PTY_COUNT must be positive, received ${PTY_COUNT}`)\n}\nif (!Number.isInteger(PAYLOAD_CHARS) || PAYLOAD_CHARS <= 0) {\n  throw new Error(`ORCA_PTY_BENCH_PAYLOAD_CHARS must be positive, received ${PAYLOAD_CHARS}`)\n}\nif (!Number.isInteger(RUNS) || RUNS <= 0) {\n  throw new Error(`ORCA_PTY_BENCH_RUNS must be positive, received ${RUNS}`)\n}\nif (!Number.isInteger(INGRESS_CHUNKS) || INGRESS_CHUNKS <= 0) {\n  throw new Error(`ORCA_PTY_BENCH_INGRESS_CHUNKS must be positive, received ${INGRESS_CHUNKS}`)\n}\nif (!Number.isInteger(INGRESS_CHUNK_CHARS) || INGRESS_CHUNK_CHARS <= 0) {\n  throw new Error(`ORCA_PTY_BENCH_INGRESS_CHARS must be positive, received ${INGRESS_CHUNK_CHARS}`)\n}\n\nfunction makePendingData() {\n  const pending = new Map()\n  for (let index = 0; index < PTY_COUNT; index++) {\n    pending.set(`pty-${index}`, `${index}:`.padEnd(PAYLOAD_CHARS, 'x'))\n  }\n  return pending\n}\n\nfunction simulateWebContentsSend(id, data) {\n  return v8.serialize({ channel: 'pty:data', payload: { id, data } }).byteLength\n}\n\nfunction flushLegacy(pending) {\n  let bytes = 0\n  const start = performance.now()\n  for (const [id, data] of pending) {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/pty-batch-flush-benchmark.mjs#L15-L51","documentation":"Thrown by config/scripts/pty-batch-flush-benchmark.mjs when ORCA_PTY_BENCH_INGRESS_CHARS fails `!Number.isInteger(INGRESS_CHUNK_CHARS) || INGRESS_CHUNK_CHARS <= 0`. INGRESS_CHUNK_CHARS (default 65536) is the character size of each ingress chunk that the batched-flush benchmark feeds in. The guard at line 32-33 rejects non-positive sizes before the data-generation loop.","triggerScenarios":"Run the benchmark with ORCA_PTY_BENCH_INGRESS_CHARS set to `0`, a negative number, empty string, or non-numeric token. parseInt at line 10 returns NaN for garbage, and the line-32 guard throws.","commonSituations":"A developer confuses INGRESS_CHARS with INGRESS_CHUNKS and sets the per-chunk character size to zero, or forwards a blank value from a templated benchmark matrix. Note the env var name is ORCA_PTY_BENCH_INGRESS_CHARS while the constant is INGRESS_CHUNK_CHARS — a frequent mismatch.","solutions":["Set ORCA_PTY_BENCH_INGRESS_CHARS to a positive integer (default 65536).","Unset it to accept the default.","Confirm you used INGRESS_CHARS (env name) and not INGRESS_CHUNKS."],"exampleFix":"// before\nORCA_PTY_BENCH_INGRESS_CHARS=0 node config/scripts/pty-batch-flush-benchmark.mjs\n\n// after\nORCA_PTY_BENCH_INGRESS_CHARS=65536 node config/scripts/pty-batch-flush-benchmark.mjs","handlingStrategy":"validation","validationCode":"const raw = process.env.ORCA_PTY_BENCH_INGRESS_CHARS\nif (raw !== undefined && (!Number.isInteger(Number(raw)) || Number(raw) <= 0)) {\n  throw new Error(`ORCA_PTY_BENCH_INGRESS_CHARS='${raw}' must be a positive integer`)\n}","typeGuard":"function isPositiveInt(value) {\n  const n = Number(value)\n  return Number.isInteger(n) && n > 0\n}","tryCatchPattern":null,"preventionTips":["The env var is ORCA_PTY_BENCH_INGRESS_CHARS (the constant is INGRESS_CHUNK_CHARS) — match the env name exactly.","Use character counts, not byte/unit suffixes.","Unset to fall back to the 65536 default."],"tags":["benchmark","env","config","pty","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}