ruvnet/ruflo · error · Error
Section "${sec.id}" extends beyond buffer (offset=${sec.offs
Error message
Section "${sec.id}" extends beyond buffer (offset=${sec.offset}, size=${sec.size}, bufLen=${totalSize}) What it means
Thrown by RvfaReader.fromBuffer() when a section's declared (offset + size) exceeds the buffer length minus the 32-byte SHA256 footer. The section table points past the end of the available data, meaning either the section data was truncated or the offsets in the header are wrong. The message names the offending section and prints its offset, size, and the buffer length for diagnosis.
Source
Thrown at v3/@claude-flow/cli/src/appliance/rvfa-format.ts:361
try {
parsed = JSON.parse(headerSlice.toString('utf-8'));
} catch {
throw new Error('Failed to parse RVFA header JSON');
}
if (!validateHeader(parsed)) {
throw new Error('RVFA header failed validation');
}
const header = parsed as RvfaHeader;
// Bounds-check every section offset
const totalSize = buf.length;
for (const sec of header.sections) {
if (sec.offset < 0 || sec.size < 0) {
throw new Error(`Section "${sec.id}" has negative offset or size`);
}
if (sec.offset + sec.size > totalSize - SHA256_SIZE) {
throw new Error(
`Section "${sec.id}" extends beyond buffer ` +
`(offset=${sec.offset}, size=${sec.size}, bufLen=${totalSize})`,
);
}
}
// Check for overlapping sections
const sorted = [...header.sections].sort((a, b) => a.offset - b.offset);
for (let i = 1; i < sorted.length; i++) {
const prev = sorted[i - 1];
const curr = sorted[i];
if (prev.offset + prev.size > curr.offset) {
throw new Error(
`Sections "${prev.id}" and "${curr.id}" overlap ` +
`(${prev.offset}+${prev.size} > ${curr.offset})`,
);
}
}View on GitHub (pinned to 6b01dc5a68)
Solutions
- Rebuild or re-download the appliance; the section data region is incomplete.
- Compare the file size to the sum of header offsets+sizes plus preamble+footer.
- If you control the writer, verify offset+size <= totalLen - 32 before finalizing.
- Inspect the named section's header entry to confirm the offset is plausible.
Defensive patterns
Strategy: validation
Validate before calling
import { validateHeader } from './rvfa-format.js';
function sectionsFitBuffer(buf: Buffer): boolean {
const hLen = buf.readUInt32LE(8);
const parsed = JSON.parse(buf.subarray(12, 12 + hLen).toString('utf-8'));
if (!validateHeader(parsed)) return false;
const usable = buf.length - 32; // minus SHA256 footer
return (parsed as any).sections.every((s: any) => s.offset + s.size <= usable);
} Try / catch
try {
const reader = RvfaReader.fromBuffer(buf);
} catch (e) {
if (/extends beyond buffer/.test((e as Error).message)) {
throw new Error('Section data region is truncated; re-download or rebuild the appliance');
}
throw e;
} Prevention
- Verify the file size matches preamble + sum(section sizes) + 32-byte footer before parsing.
- Write appliances atomically (tmp + rename) to avoid truncated files on disk.
- Use content-addressed storage (IPFS) so truncation produces a different CID.
- Run reader.verify() to catch integrity issues after parsing.
When it happens
Trigger: The appliance file was truncated after the header but before all section bytes were written; the header offsets are stale relative to a body that was shortened; a custom writer computed offsets against a larger buffer than it actually emitted.
Common situations: Interrupted build or download; disk-full during write; a section that was stripped without updating the header; a copy that truncated the file.
Related errors
- Buffer too small to contain declared header
- Section "${sec.id}" has negative offset or size
- Sections "${prev.id}" and "${curr.id}" overlap (${prev.offse
- KV cache file truncated
- Buffer too small for declared header
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/f8f5532581c7be8c.
Report an issue: GitHub.