probelabs/goreplay · error
error writing packet header: %v
Error message
error writing packet header: %v
What it means
Writer.WritePacket wraps the underlying writer failure that occurred while writing the 16-byte pcap record header (disk full, closed writer, I/O error), reporting the capture info for context.
Source
Thrown at internal/capture/dump.go:122
usecs := t.Nanosecond() / w.tsScaler
binary.LittleEndian.PutUint32(w.buf[0:4], uint32(secs))
binary.LittleEndian.PutUint32(w.buf[4:8], uint32(usecs))
binary.LittleEndian.PutUint32(w.buf[8:12], uint32(ci.CaptureLength))
binary.LittleEndian.PutUint32(w.buf[12:16], uint32(ci.Length))
_, err := w.w.Write(w.buf[:])
return err
}
// WritePacket writes the given packet data out to the file.
func (w *Writer) WritePacket(ci gopacket.CaptureInfo, data []byte) error {
if ci.CaptureLength != len(data) {
return fmt.Errorf("capture length %d does not match data length %d", ci.CaptureLength, len(data))
}
if ci.CaptureLength > ci.Length {
return fmt.Errorf("invalid capture info %+v: capture length > length", ci)
}
if err := w.writePacketHeader(ci); err != nil {
return fmt.Errorf("error writing packet header: %v", err)
}
_, err := w.w.Write(data)
return err
}
View on GitHub (pinned to 251e45abd2)
Solutions
- Check disk space and write permissions for the output capture file
- Verify the output writer wasn't closed concurrently
- Inspect the wrapped %v error for the OS-level I/O cause
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/capture/dump.go:122 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02).
Data as JSON: /api/errors/f275969668539f98.
Report an issue: GitHub.