ruvnet/ruflo · error · Error
Buffer too small to be a valid RVFA file
Error message
Buffer too small to be a valid RVFA file
What it means
Thrown by parseRvfaBinary when the input is smaller than the minimum RVFA framing (preamble + SHA256 footer). A buffer this short cannot structurally be an RVFA image.
Source
Thrown at v3/@claude-flow/cli/src/appliance/rvfa-signing.ts:170
return sorted;
}
return val;
});
}
/**
* Parse an RVFA binary into its components without full validation.
* Returns the header object, header JSON bytes, section data region, and footer.
*/
function parseRvfaBinary(buf: Buffer): {
header: Record<string, unknown>;
headerStart: number;
headerEnd: number;
sectionData: Buffer;
footer: Buffer;
} {
if (buf.length < PREAMBLE_SIZE + SHA256_SIZE) {
throw new Error('Buffer too small to be a valid RVFA file');
}
const magic = buf.subarray(0, 4).toString('ascii');
if (magic !== 'RVFA') {
throw new Error(`Invalid RVFA magic: expected "RVFA", got "${magic}"`);
}
const headerLen = buf.readUInt32LE(8);
const headerStart = PREAMBLE_SIZE;
const headerEnd = headerStart + headerLen;
if (headerEnd > buf.length - SHA256_SIZE) {
throw new Error('Header length extends beyond buffer');
}
const headerJson = buf.subarray(headerStart, headerEnd).toString('utf-8');
let header: Record<string, unknown>;
try {View on GitHub (pinned to 6b01dc5a68)
Solutions
- Confirm the input is actually an RVFA image.
- Stat the file and reject obviously small files before reading.
- Re-fetch the file if its size is implausibly small.
Example fix
// before
parseRvfaBinary(await readFile(maybeBrokenPath));
// after
const buf = await readFile(maybeBrokenPath);
if (buf.length < PREAMBLE_SIZE + SHA256_SIZE) {
throw new Error(`File too small (${buf.length} bytes) to be RVFA`);
}
parseRvfaBinary(buf); Defensive patterns
Strategy: validation
Validate before calling
const MIN_RVFA = PREAMBLE_SIZE + SHA256_SIZE; // e.g. 12 + 32
if (!Buffer.isBuffer(buf) || buf.length < MIN_RVFA) {
throw new Error(`Not an RVFA file (only ${buf?.length ?? 0} bytes)`);
} Prevention
- Stat the file and reject obviously small files before reading.
- Keep framing constants exported so callers can pre-check.
- Distinguish 'too small' from 'wrong magic' for clearer diagnostics.
When it happens
Trigger: Passing an empty buffer, a few-byte stub, or a non-RVFA file (text, directory read as bytes) to the signing parser.
Common situations: Wrong file path resolving to a tiny artifact; a download that produced 0 bytes; reading a symlink target that is empty.
Related errors
- Invalid RVFA magic: expected "RVFA", got "${magic}"
- Header length extends beyond buffer
- Footer hash must be ${SHA256_SIZE} bytes, got ${footerHash.l
- unknown game "${key}". Known: ${Object.keys(GAMES).join(', '
- unknown strategy "${name}". Available: ${roster.map((r) => r
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/47dd913ce1c99619.
Report an issue: GitHub.