pion/webrtc · error
incomplete file header
Error message
incomplete file header
What it means
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.
Source
Thrown at pkg/media/ivfreader/ivfreader.go:24
import (
"encoding/binary"
"errors"
"fmt"
"io"
)
const (
ivfFileHeaderSignature = "DKIF"
ivfFileHeaderSize = 32
ivfFrameHeaderSize = 12
)
var (
errNilStream = errors.New("stream is nil")
errIncompleteFrameHeader = errors.New("incomplete frame header")
errIncompleteFrameData = errors.New("incomplete frame data")
errIncompleteFileHeader = errors.New("incomplete file header")
errSignatureMismatch = errors.New("IVF signature mismatch")
errUnknownIVFVersion = errors.New("IVF version unknown, parser may not parse correctly")
errInvalidMediaTimebase = errors.New("invalid media timebase")
)
// IVFFileHeader 32-byte header for IVF files
// https://wiki.multimedia.cx/index.php/IVF
type IVFFileHeader struct {
signature string // 0-3
version uint16 // 4-5
headerSize uint16 // 6-7
FourCC string // 8-11
Width uint16 // 12-13
Height uint16 // 14-15
TimebaseDenominator uint32 // 16-19
TimebaseNumerator uint32 // 20-23
NumFrames uint32 // 24-27
unused uint32 // 28-31View on GitHub (pinned to 8c25dc09fa)
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.
Example fix
// before
f, _ := os.Open(path)
r, hdr, _ := ivfreader.NewWith(f)
// after
fi, err := f.Stat()
if err != nil || fi.Size() < 32 {
return fmt.Errorf("%s is too small to be an IVF file", path)
}
r, hdr, err := ivfreader.NewWith(f) Defensive patterns
Strategy: validation
Validate before calling
fi, err := f.Stat()
if err != nil {
return err
}
if fi.Size() < 32 {
return fmt.Errorf("%s: too small to be an IVF file (<32 bytes)", path)
} Try / catch
if err == ivfreader.ErrIncompleteFileHeader {
return fmt.Errorf("input too short to be an IVF file: %w", err)
} Prevention
- 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.
When it happens
Trigger: First parse on a stream with fewer than 32 bytes total (NewWith reads the file header immediately).
Common situations: Empty files, wrong file passed (a few-byte text file), severely truncated downloads, misconfigured paths pointing at the wrong artifact.
Related errors
- incomplete frame header
- incomplete frame data
- stream is nil
- IVF signature mismatch
- IVF version unknown, parser may not parse correctly
AI-assisted analysis of pion/webrtc@8c25dc09fa (2026-09-03).
Data as JSON: /api/errors/32a2aee4359a2e02.
Report an issue: GitHub.