{"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":"validation","errorClass":"Error","httpStatus":null,"severity":"error","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/council-multi-model/scripts/review-with-codex.js#L164-L200","documentation":"runReview() validates the review packet before invoking Codex. A packet that is empty or contains only whitespace fails `!prompt.trim()` and throws 'review packet is empty'. The script refuses to send a useless empty prompt to the external model.","triggerScenarios":"runReview(prompt, options) called with prompt = '' or a whitespace-only string (e.g. '\\n', '   '); in the CLI path this happens when stdin delivered no bytes or only whitespace.","commonSituations":"Piping an empty file or an empty command substitution into the script (`echo -n '' | review-with-codex.js ...`); an upstream step that produced no diff/notes; a variable holding the packet that was never populated.","solutions":["Ensure the review packet (stdin or the prompt argument) contains non-whitespace content before calling runReview","Check the upstream command that generates the packet actually produced output (e.g. `git diff` in a repo with changes)","Guard the caller: `if (!packet.trim()) { skip review }` before invoking","When piping, verify you used the correct file/variable and not an uninitialized one"],"exampleFix":"// before\nconst review = runReview(fs.readFileSync('packet.txt', 'utf8'), options);\n// after\nconst packet = fs.readFileSync('packet.txt', 'utf8');\nif (!packet.trim()) throw new Error('packet.txt is empty; nothing to review');\nconst review = runReview(packet, options);","handlingStrategy":"validation","validationCode":"function isNonEmptyPacket(prompt) {\n  return typeof prompt === 'string' && prompt.trim().length > 0;\n}\nif (!isNonEmptyPacket(packet)) throw new Error('review packet is empty');","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  return runReview(prompt, options);\n} catch (err) {\n  if (err.message === 'review packet is empty') {\n    console.error('Nothing to review: packet was blank');\n    return null;\n  }\n  throw err;\n}","preventionTips":["Always check packet.trim().length before invoking external review","Verify upstream generators (diff/log commands) exited successfully","Never pipe from commands that can silently produce empty output without checking","Add a unit test asserting runReview rejects blank packets"],"tags":["validation","empty-input","codex"],"backgroundTag":"empty-required-field","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}