{"record":{"id":"f275969668539f98","repo":"probelabs/goreplay","slug":"error-writing-packet-header-v","errorCode":null,"errorMessage":"error writing packet header: %v","messagePattern":"error writing packet header: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/capture/dump.go","lineNumber":122,"sourceCode":"\tusecs := t.Nanosecond() / w.tsScaler\n\tbinary.LittleEndian.PutUint32(w.buf[0:4], uint32(secs))\n\tbinary.LittleEndian.PutUint32(w.buf[4:8], uint32(usecs))\n\tbinary.LittleEndian.PutUint32(w.buf[8:12], uint32(ci.CaptureLength))\n\tbinary.LittleEndian.PutUint32(w.buf[12:16], uint32(ci.Length))\n\t_, err := w.w.Write(w.buf[:])\n\treturn err\n}\n\n// WritePacket writes the given packet data out to the file.\nfunc (w *Writer) WritePacket(ci gopacket.CaptureInfo, data []byte) error {\n\tif ci.CaptureLength != len(data) {\n\t\treturn fmt.Errorf(\"capture length %d does not match data length %d\", ci.CaptureLength, len(data))\n\t}\n\tif ci.CaptureLength > ci.Length {\n\t\treturn fmt.Errorf(\"invalid capture info %+v:  capture length > length\", ci)\n\t}\n\tif err := w.writePacketHeader(ci); err != nil {\n\t\treturn fmt.Errorf(\"error writing packet header: %v\", err)\n\t}\n\t_, err := w.w.Write(data)\n\treturn err\n}\n","sourceCodeStart":104,"sourceCodeEnd":127,"githubUrl":"https://github.com/probelabs/goreplay/blob/251e45abd242886bb64ff2b2dc98789556b56330/internal/capture/dump.go#L104-L127","documentation":"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.","triggerScenarios":"Thrown at internal/capture/dump.go:122 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"251e45abd242886bb64ff2b2dc98789556b56330","analyzedAt":"2026-09-02T16:44:11.369Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}