affaan-m/ECC · error · Error
review packet exceeds
Error message
review packet exceeds ${MAX_PROMPT_BYTES} bytes What it means
runReview() enforces a hard payload cap of MAX_PROMPT_BYTES (64 KiB) on the UTF-8 byte length of the review packet. Packets larger than 64 * 1024 bytes throw this error, protecting against oversized prompts to the Codex CLI. The stdin wrapper (runStdinReview) enforces the same limit incrementally.
Solutions
- Trim the packet to under 64 KiB before calling runReview (truncate the diff, review files in batches)
- Use byte-aware truncation (Buffer.byteLength) rather than character length to account for multi-byte characters
- Split the review into multiple smaller packets and run runReview per chunk
- Summarize or filter the diff (e.g. `git diff --stat` plus key hunks) to reduce size
Example fix
// before
const review = runReview(hugeDiff, options); // throws >64KiB
// after
let packet = hugeDiff;
while (Buffer.byteLength(packet, 'utf8') > 64 * 1024) {
packet = packet.slice(0, Math.floor(packet.length * 0.9));
}
const review = runReview(packet, options); Defensive patterns
Strategy: validation
Validate before calling
const { MAX_PROMPT_BYTES } = require('./review-with-codex');
function packetFits(prompt) {
return Buffer.byteLength(prompt, 'utf8') <= MAX_PROMPT_BYTES;
}
if (!packetFits(packet)) packet = truncateToBytes(packet, MAX_PROMPT_BYTES); Try / catch
try {
return runReview(prompt, options);
} catch (err) {
if (err.message.includes('review packet exceeds')) {
console.error('Packet too large; split or truncate to <= 65536 bytes');
return null;
}
throw err;
} Prevention
- Measure size with Buffer.byteLength (UTF-8 bytes), not string length
- Truncate diffs to relevant hunks before review
- Batch large reviews into multiple packets
- Reuse the exported MAX_PROMPT_BYTES constant in caller-side checks
When it happens
Trigger: runReview(prompt, options) where Buffer.byteLength(prompt, 'utf8') > 65536 — e.g. piping a large git diff, long logs, or many files into the script.
Common situations: Reviewing a big PR diff without truncation; piping concatenated files; non-ASCII content (multi-byte UTF-8) pushing a modest-looking packet over the byte cap.
Understand the failure class
Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.
Related errors
- harness health evidence exceeds integrity verification bound
- references exceed bounded limits
- OpenAI transfer consent is required
- review packet is empty
- -32001
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/6273c831f52a6605.
Report an issue: GitHub.
Appendix: source
Thrown at skills/council-multi-model/scripts/review-with-codex.js:184
);
}
return versionMatch[1];
}
function buildEnvironment(sourceEnv = process.env) {
const allowed = [
'PATH', 'HOME', 'USERPROFILE', 'CODEX_HOME',
'TMPDIR', 'TMP', 'TEMP', 'SystemRoot', 'ComSpec', 'PATHEXT',
];
return Object.fromEntries(
allowed.filter((name) => sourceEnv[name]).map((name) => [name, sourceEnv[name]])
);
}
function runReview(prompt, options, dependencies = {}) {
if (!prompt.trim()) throw new Error('review packet is empty');
if (Buffer.byteLength(prompt, 'utf8') > MAX_PROMPT_BYTES) {
throw new Error(`review packet exceeds ${MAX_PROMPT_BYTES} bytes`);
}
if (!options.consent) throw new Error('OpenAI transfer consent is required');
if (options.timeoutMs < 10_000 || options.timeoutMs > MAX_TIMEOUT_MS) {
throw new Error('timeout is outside the 10-120 second safety range');
}
const spawn = dependencies.spawnSync || spawnSync;
const environment = buildEnvironment(dependencies.env || process.env);
const verifySupport = dependencies.verifyToollessSupport || verifyToollessSupport;
verifySupport({ spawnSync: spawn, env: environment });
const makeTemp = dependencies.mkdtempSync || fs.mkdtempSync;
const readFile = dependencies.readFileSync || fs.readFileSync;
const remove = dependencies.rmSync || fs.rmSync;
const tempDir = makeTemp(path.join(os.tmpdir(), 'ecc-council-review-'));
const outputFile = path.join(tempDir, 'last-message.txt');
try {
const result = spawn('codex', buildCodexArgs(tempDir, outputFile), {View on GitHub (pinned to 8321021c54)