pion/webrtc · error
%w: expected(0) got(%d)
Error message
%w: expected(0) got(%d)
What it means
Thrown by parseFileHeader after reading an IVF file header whose version field is not 0. The IVF format defines version 0 as the only valid value; a nonzero version means the file is malformed, corrupted, or not actually IVF despite a matching signature, so the parser rejects it before returning the header to NewWith callers.
Source
Thrown at pkg/media/ivfreader/ivfreader.go:157
}
header := &IVFFileHeader{
signature: string(buffer[:4]),
version: binary.LittleEndian.Uint16(buffer[4:6]),
headerSize: binary.LittleEndian.Uint16(buffer[6:8]),
FourCC: string(buffer[8:12]),
Width: binary.LittleEndian.Uint16(buffer[12:14]),
Height: binary.LittleEndian.Uint16(buffer[14:16]),
TimebaseDenominator: binary.LittleEndian.Uint32(buffer[16:20]),
TimebaseNumerator: binary.LittleEndian.Uint32(buffer[20:24]),
NumFrames: binary.LittleEndian.Uint32(buffer[24:28]),
unused: binary.LittleEndian.Uint32(buffer[28:32]),
}
if header.signature != ivfFileHeaderSignature {
return nil, errSignatureMismatch
} else if header.version != uint16(0) {
return nil, fmt.Errorf("%w: expected(0) got(%d)", errUnknownIVFVersion, header.version)
}
i.bytesReadSuccesfully += int64(bytesRead)
return header, nil
}
View on GitHub (pinned to 8c25dc09fa)
Solutions
- Verify the input file is a genuine IVF container produced by a standard muxer (e.g. ffmpeg's ivf muxer) and not a renamed or truncated file
- Inspect bytes 4-6 of the file (the version field) with a hex dump to confirm the value being rejected
- Re-mux the source stream into a fresh IVF file with a known-good tool instead of hand-crafting the header
- If a nonzero version must be tolerated, patch parseFileHeader to accept it explicitly — but note the reader's field offsets are only validated for version 0
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/media/ivfreader/ivfreader.go:157 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pion/webrtc@8c25dc09fa (2026-09-03).
Data as JSON: /api/errors/546cc274980aa782.
Report an issue: GitHub.