{"record":{"id":"4222cfe9c33d741f","repo":"affaan-m/ECC","slug":"review-packet-is-empty","errorCode":null,"errorMessage":"review packet is empty","messagePattern":"review packet is empty","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"skills/council-multi-model/scripts/review-with-codex.js","lineNumber":182,"sourceCode":"      `Codex ${versionMatch[1]} cannot guarantee tool-less review; `\n      + `required stable feature toggles unavailable: ${unavailable.join(', ')}`\n    );\n  }\n  return versionMatch[1];\n}\n\nfunction buildEnvironment(sourceEnv = process.env) {\n  const allowed = [\n    'PATH', 'HOME', 'USERPROFILE', 'CODEX_HOME',\n    'TMPDIR', 'TMP', 'TEMP', 'SystemRoot', 'ComSpec', 'PATHEXT',\n  ];\n  return Object.fromEntries(\n    allowed.filter((name) => sourceEnv[name]).map((name) => [name, sourceEnv[name]])\n  );\n}\n\nfunction runReview(prompt, options, dependencies = {}) {\n  if (!prompt.trim()) throw new Error('review packet is empty');\n  if (Buffer.byteLength(prompt, 'utf8') > MAX_PROMPT_BYTES) {\n    throw new Error(`review packet exceeds ${MAX_PROMPT_BYTES} bytes`);\n  }\n  if (!options.consent) throw new Error('OpenAI transfer consent is required');\n  if (options.timeoutMs < 10_000 || options.timeoutMs > MAX_TIMEOUT_MS) {\n    throw new Error('timeout is outside the 10-120 second safety range');\n  }\n\n  const spawn = dependencies.spawnSync || spawnSync;\n  const environment = buildEnvironment(dependencies.env || process.env);\n  const verifySupport = dependencies.verifyToollessSupport || verifyToollessSupport;\n  verifySupport({ spawnSync: spawn, env: environment });\n  const makeTemp = dependencies.mkdtempSync || fs.mkdtempSync;\n  const readFile = dependencies.readFileSync || fs.readFileSync;\n  const remove = dependencies.rmSync || fs.rmSync;\n  const tempDir = makeTemp(path.join(os.tmpdir(), 'ecc-council-review-'));\n  const outputFile = path.join(tempDir, 'last-message.txt');\n","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/skills/council-multi-model/scripts/review-with-codex.js#L164-L200","documentation":"Thrown by runReview() as its very first check when the prompt passed to it is empty or whitespace-only (prompt.trim() is falsy). The review packet is read from stdin and joined into a single string before runReview is called, so this means stdin carried no meaningful content. There is nothing to send to Codex, so the function bails before any spawn.","triggerScenarios":"Piping an empty or whitespace-only string into the script: `echo '' | review-with-codex.js ...`, piping /dev/null, or a caller that builds the packet from variables that expanded to nothing. Note runStdinReview has a separate size guard for the >64KB case, but an empty input is caught here.","commonSituations":"An upstream command that produced no review packet (e.g. git diff with no changes); an unset env var that the packet was built from; a misconfigured pipe that closed early; CI that runs review unconditionally even when there is nothing to review.","solutions":["Make sure stdin has a non-empty packet: build it from real diff/context and verify before piping.","Skip the review step in CI when the packet would be empty (e.g. `if [ -s packet.txt ]; then ... review-with-codex.js < packet.txt; fi`).","Check the upstream command that feeds stdin actually produced output."],"exampleFix":"// before\necho \"\" | node skills/council-multi-model/scripts/review-with-codex.js --consent-to-openai --host-provider anthropic\n// -> Error: review packet is empty\n\n// after\ngit diff main...HEAD > /tmp/packet.txt\n[ -s /tmp/packet.txt ] && node skills/council-multi-model/scripts/review-with-codex.js --consent-to-openai --host-provider anthropic < /tmp/packet.txt","handlingStrategy":"validation","validationCode":"function ensureNonEmptyPacket(prompt) {\n  if (typeof prompt !== 'string' || !prompt.trim()) {\n    throw new Error('review packet is empty');\n  }\n  return prompt;\n}\n// call before runReview: ensureNonEmptyPacket(promptText)","typeGuard":"function isNonEmptyPacket(prompt) {\n  return typeof prompt === 'string' && prompt.trim().length > 0;\n}","tryCatchPattern":"try {\n  stdout.write(runReview(packet, options) + '\\n');\n} catch (error) {\n  if (/review packet is empty/.test(error.message)) {\n    stderr.write('nothing to review; skipping external critique\\n');\n    setExitCode(0); // treat as non-fatal when there is genuinely nothing to review\n  } else {\n    stderr.write(`external review absent: ${error.message}\\n`);\n    setExitCode(1);\n  }\n}","preventionTips":["Build the packet from real diff/context and verify it is non-empty before piping.","Skip the review step in CI when the packet would be empty (e.g. `[ -s packet.txt ] && ...`).","Check the upstream command that feeds stdin actually produced output."],"tags":["cli","validation","stdin","empty-input","review"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}