{"record":{"id":"32a2aee4359a2e02","repo":"pion/webrtc","slug":"incomplete-file-header","errorCode":null,"errorMessage":"incomplete file header","messagePattern":"incomplete file header","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/media/ivfreader/ivfreader.go","lineNumber":24,"sourceCode":"\nimport (\n\t\"encoding/binary\"\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n)\n\nconst (\n\tivfFileHeaderSignature = \"DKIF\"\n\tivfFileHeaderSize      = 32\n\tivfFrameHeaderSize     = 12\n)\n\nvar (\n\terrNilStream             = errors.New(\"stream is nil\")\n\terrIncompleteFrameHeader = errors.New(\"incomplete frame header\")\n\terrIncompleteFrameData   = errors.New(\"incomplete frame data\")\n\terrIncompleteFileHeader  = errors.New(\"incomplete file header\")\n\terrSignatureMismatch     = errors.New(\"IVF signature mismatch\")\n\terrUnknownIVFVersion     = errors.New(\"IVF version unknown, parser may not parse correctly\")\n\terrInvalidMediaTimebase  = errors.New(\"invalid media timebase\")\n)\n\n// IVFFileHeader 32-byte header for IVF files\n// https://wiki.multimedia.cx/index.php/IVF\ntype IVFFileHeader struct {\n\tsignature           string // 0-3\n\tversion             uint16 // 4-5\n\theaderSize          uint16 // 6-7\n\tFourCC              string // 8-11\n\tWidth               uint16 // 12-13\n\tHeight              uint16 // 14-15\n\tTimebaseDenominator uint32 // 16-19\n\tTimebaseNumerator   uint32 // 20-23\n\tNumFrames           uint32 // 24-27\n\tunused              uint32 // 28-31","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/pion/webrtc/blob/8c25dc09fa9e7c09aac4309ead88093d760432b0/pkg/media/ivfreader/ivfreader.go#L6-L42","documentation":"Returned by parseFileHeader when io.ReadFull gets io.ErrUnexpectedEOF while reading the 32-byte IVF file header, meaning the stream is shorter than a full IVF header. Such data cannot be an IVF file at all.","triggerScenarios":"First parse on a stream with fewer than 32 bytes total (NewWith reads the file header immediately).","commonSituations":"Empty files, wrong file passed (a few-byte text file), severely truncated downloads, misconfigured paths pointing at the wrong artifact.","solutions":["Check the file size is at least 32 bytes before parsing.","Confirm you're passing an actual IVF (DKIF) file and not another format.","Re-download/restore the file if it was truncated."],"exampleFix":"// before\nf, _ := os.Open(path)\nr, hdr, _ := ivfreader.NewWith(f)\n// after\nfi, err := f.Stat()\nif err != nil || fi.Size() < 32 {\n    return fmt.Errorf(\"%s is too small to be an IVF file\", path)\n}\nr, hdr, err := ivfreader.NewWith(f)","handlingStrategy":"validation","validationCode":"fi, err := f.Stat()\nif err != nil {\n    return err\n}\nif fi.Size() < 32 {\n    return fmt.Errorf(\"%s: too small to be an IVF file (<32 bytes)\", path)\n}","typeGuard":null,"tryCatchPattern":"if err == ivfreader.ErrIncompleteFileHeader {\n    return fmt.Errorf(\"input too short to be an IVF file: %w\", err)\n}","preventionTips":["Check minimum file size (32 bytes) before opening IVF readers.","Validate file paths/config point to real IVF artifacts.","Detect empty files at ingest time and reject them early."],"tags":["go","media","ivf","truncated-data","file-header"],"backgroundTag":"truncated-input-stream","analyzedSha":"8c25dc09fa9e7c09aac4309ead88093d760432b0","analyzedAt":"2026-09-03T21:56:56.182Z","contentChangedAt":"2026-09-03T21:56:56.182Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}