{"record":{"id":"929536cce62226c4","repo":"pion/webrtc","slug":"w-expected-opushead-got-s","errorCode":null,"errorMessage":"%w: expected OpusHead, got %s","messagePattern":"%w: expected OpusHead, got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/media/oggreader/oggreader.go","lineNumber":217,"sourceCode":"func validateOpusPageHeader(pageHeader *OggPageHeader, payload []byte) error {\n\tif string(pageHeader.sig[:]) != pageHeaderSignature {\n\t\treturn errBadIDPageSignature\n\t}\n\n\tif pageHeader.headerType != pageHeaderTypeBeginningOfStream {\n\t\treturn errBadIDPageType\n\t}\n\n\tif len(payload) < idPageBasePayloadLength {\n\t\treturn errBadIDPageLength\n\t}\n\n\tif sig, ok := opusPayloadSignature(payload); !ok || sig != HeaderOpusID {\n\t\treturn fmt.Errorf(\"%w: expected OpusHead, got %s\", errBadIDPagePayloadSignature, sig)\n\t}\n\n\treturn nil\n}","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/pion/webrtc/blob/8c25dc09fa9e7c09aac4309ead88093d760432b0/pkg/media/oggreader/oggreader.go#L199-L235","documentation":"Raised in oggreader.validateOpusPageHeader (called from readOpusHeader) when the first logical Ogg page of an Opus stream does not carry the required \"OpusHead\" identification-page payload signature. The wrap includes the signature actually found (possibly empty when the payload is too short to contain one). The offending input is an Ogg stream whose ID page payload is not an Opus identification header.","triggerScenarios":"Thrown at pkg/media/oggreader/oggreader.go:217 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the input is an Opus-in-Ogg stream, not another codec (e.g. Vorbis) or arbitrary data","Check the stream starts at the beginning; joining mid-stream skips the OpusHead ID page","Re-mux the file with ffmpeg (ffmpeg -i in.ogg -c copy fixed.ogg) to regenerate headers","Log the wrapped signature to diagnose what codec the page actually contains"],"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"}