benbjohnson/litestream · error
write page to buffer: %w
Error message
write page to buffer: %w
What it means
VFSFile.writeToBuffer's WriteAt of a dirty page into the durability buffer file failed. The buffer file (buffer_path) is unwritable or the disk is full — dirty pages can no longer be staged safely before replication.
Source
Thrown at vfs.go:2224
// writeToBuffer writes a dirty page to the write buffer for durability.
// If the page already exists in the buffer, it overwrites at the same offset.
// Otherwise, it appends to the end of the file.
// Must be called with f.mu held.
func (f *VFSFile) writeToBuffer(pgno uint32, data []byte) error {
var writeOffset int64
if existingOff, ok := f.dirty[pgno]; ok {
// Page already exists - overwrite at same offset
writeOffset = existingOff
} else {
// New page - append to end of file
writeOffset = f.bufferNextOff
f.bufferNextOff += int64(len(data))
}
// Write page data (no header, just raw page data)
if _, err := f.bufferFile.WriteAt(data, writeOffset); err != nil {
return fmt.Errorf("write page to buffer: %w", err)
}
// Update dirty map with offset
f.dirty[pgno] = writeOffset
return nil
}
// clearWriteBuffer clears and resets the write buffer after successful sync.
func (f *VFSFile) clearWriteBuffer() error {
// Truncate file to zero
if err := f.bufferFile.Truncate(0); err != nil {
return fmt.Errorf("truncate buffer: %w", err)
}
// Reset next write offset
f.bufferNextOff = 0
View on GitHub (pinned to 4ed7a308f6)
Solutions
- Check disk space and permissions on the buffer file path
- Verify buffer_path points to writable storage
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at vfs.go:2224 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/65c63f5f5661a382.
Report an issue: GitHub.