{"record":{"id":"5cfe475b9e257ae9","repo":"pion/webrtc","slug":"codec-is-unset","errorCode":null,"errorMessage":"codec is unset","messagePattern":"codec is unset","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/media/ivfwriter/ivfwriter.go","lineNumber":21,"sourceCode":"\t// FOURCC\n\tswitch i.codec {\n\tcase codecVP8:\n\t\tcopy(header[8:], \"VP80\")\n\tcase codecVP9:\n\t\tcopy(header[8:], \"VP90\")\n\tcase codecAV1:\n\t\tcopy(header[8:], \"AV01\")\n\tdefault:\n\t\treturn errCodecUnset\n\t}\n\n\tbinary.LittleEndian.PutUint16(header[12:], i.videoWidth)          // Width in pixels\n\tbinary.LittleEndian.PutUint16(header[14:], i.videoHeight)         // Height in pixels\n\tbinary.LittleEndian.PutUint32(header[16:], i.timebaseDenominator) // Framerate denominator\n\tbinary.LittleEndian.PutUint32(header[20:], i.timebaseNumerator)   // Framerate numerator","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/pion/webrtc/blob/8c25dc09fa9e7c09aac4309ead88093d760432b0/pkg/media/ivfwriter/ivfwriter.go#L3-L39","documentation":"Sentinel error returned when the writer's internal codec state is unset so no IVF FOURCC can be selected. It fires in writeHeader (no FOURCC like \"VP80\"/\"VP90\"/\"AV01\" can be stamped into the 32-byte file header) and in WriteRTP's codec dispatch default branch. In normal use NewWith defaults to VP8, so this occurs only when the writer was constructed without going through NewWith or its state was left unset.","triggerScenarios":"Thrown at pkg/media/ivfwriter/ivfwriter.go:21 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct the writer with NewWith, which defaults the codec to VP8 when none was chosen","Pass WithCodec(mimeTypeVP8|VP9|AV1) as an option to NewWith to select a codec explicitly","If writing header manually, ensure i.codec is set before calling writeHeader"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}