{"record":{"id":"dd280dcbd837bf85","repo":"pion/webrtc","slug":"ivf-signature-mismatch","errorCode":null,"errorMessage":"IVF signature mismatch","messagePattern":"IVF signature mismatch","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/media/ivfreader/ivfreader.go","lineNumber":25,"sourceCode":"if header.signature != ivfFileHeaderSignature {\n\treturn nil, errSignatureMismatch\n} else if header.version != uint16(0) {\n\treturn nil, fmt.Errorf(\"%w: expected(0) got(%d)\", errUnknownIVFVersion, header.version)\n}\n\ni.bytesReadSuccesfully += int64(bytesRead)\n\nreturn header, nil","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/pion/webrtc/blob/8c25dc09fa9e7c09aac4309ead88093d760432b0/pkg/media/ivfreader/ivfreader.go#L7-L43","documentation":"The IVF reader's parseFileHeader rejects a file whose first 4 bytes do not equal the required IVF signature \"DKIF\". It is a sentinel error fired by a generic guard whenever NewWith is given a stream that is not an IVF container (wrong format, truncated, or shifted data).","triggerScenarios":"NewWith/parseFileHeader on a non-IVF stream: the first four bytes differ from 'D','K','I','F'.","commonSituations":"Passing WebM/MKV, MP4, OGG, or raw frame dumps where an IVF was expected; wrong file extension; files concatenated with other formats.","solutions":["Verify the input file begins with the bytes \"DKIF\" before parsing.","Point the code at the correct IVF file or convert the source (e.g. via ffmpeg) to IVF.","Classify with errors.Is(err, errSignatureMismatch) to report a friendly 'not an IVF file' message."],"exampleFix":"// before\nf, _ := os.Open(path)\nr, _, _ := ivfreader.NewWith(f)\n// after\nmagic := make([]byte, 4)\nio.ReadFull(f, magic)\nif string(magic) != \"DKIF\" {\n    return fmt.Errorf(\"%s is not an IVF file\", path)\n}\nf.Seek(0, io.SeekStart)\nr, _, err := ivfreader.NewWith(f)","handlingStrategy":"validation","validationCode":"magic := make([]byte, 4)\nif _, err := io.ReadFull(f, magic); err != nil {\n    return err\n}\nif string(magic) != \"DKIF\" {\n    return fmt.Errorf(\"%s: not an IVF file (bad magic)\", path)\n}\nf.Seek(0, io.SeekStart)","typeGuard":null,"tryCatchPattern":"if err == ivfreader.ErrSignatureMismatch {\n    return fmt.Errorf(\"input is not an IVF file: %w\", err)\n}","preventionTips":["Sniff the first 4 bytes (\"DKIF\") before parsing any allegedly-IVF input.","Ensure upload/ingest pipelines enforce the expected container format.","Don't rely on file extensions; always verify magic bytes."],"tags":["go","media","ivf","signature","wrong-format"],"backgroundTag":"bad-file-signature","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"}