{"record":{"id":"98503a725bf92b2f","repo":"remotion-dev/remotion","slug":"file-type-filetype-not-supported","errorCode":null,"errorMessage":"File type ${fileType} not supported","messagePattern":"File type (.+?) not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/riff/parse-riff-header.ts","lineNumber":15,"sourceCode":"import type {ParseResult} from '../../parse-result';\nimport type {ParserState} from '../../state/parser-state';\n\nexport const parseRiffHeader = (state: ParserState): ParseResult => {\n\tconst riff = state.iterator.getByteString(4, false);\n\tif (riff !== 'RIFF') {\n\t\tthrow new Error('Not a RIFF file');\n\t}\n\n\tconst structure = state.structure.getRiffStructure();\n\n\tconst size = state.iterator.getUint32Le();\n\tconst fileType = state.iterator.getByteString(4, false);\n\tif (fileType !== 'WAVE' && fileType !== 'AVI') {\n\t\tthrow new Error(`File type ${fileType} not supported`);\n\t}\n\n\tstructure.boxes.push({type: 'riff-header', fileSize: size, fileType});\n\n\treturn null;\n};\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/riff/parse-riff-header.ts#L1-L22","documentation":"Thrown by parseRiffHeader() after reading bytes 8..12 of the RIFF header: the fileType field must be 'WAVE' or 'AVI'. Other RIFF subtypes exist (e.g. 'WEBP' for WebP, 'CDXA' for Video CD, 'RF64' for extended WAV) and are not supported by this parser.","triggerScenarios":"Parsing a RIFF file whose subtype is neither WAVE nor AVI — most commonly a WebP image (RIFF/WEDP... actually 'WEBP'), an RF64 broadcast WAV, or a lesser-known RIFF form.","commonSituations":"Passing a WebP image or an RF64 WAV to @remotion/media-parser expecting WAV/AVI support; mislabeled file extension.","solutions":["Identify the RIFF subtype (bytes 8..12) and route accordingly — WebP must go through an image decoder, RF64 WAV needs a different parser.","Re-export to a plain WAV (PCM) or AVI if your workflow requires RIFF/WAVE.","Pre-check the subtype and surface a clearer error to the user before invoking the parser."],"exampleFix":"// before\nawait parseMediaStream({src: assetUrl}); // assetUrl is actually a WebP\n\n// after: confirm WAVE/AVI subtype\nconst sub = new TextDecoder().decode(bytes8to12);\nif (sub !== 'WAVE' && sub !== 'AVI') throw new Error(`RIFF subtype ${sub} not supported`);","handlingStrategy":"validation","validationCode":"// Check the RIFF subtype (bytes 8..12) before parsing.\nconst head = new Uint8Array(await (await fetch(url, {headers: {Range: 'bytes=0-11'}})).arrayBuffer());\nconst subtype = new TextDecoder().decode(head.subarray(8, 12));\nif (subtype !== 'WAVE' && subtype !== 'AVI') {\n  throw new Error(`RIFF subtype ${subtype} not supported (use WAV/AVI)`);\n}","typeGuard":"type RiffSubtype = 'WAVE' | 'AVI';\nfunction isSupportedRiffSubtype(s: string): s is RiffSubtype {\n  return s === 'WAVE' || s === 'AVI';\n}","tryCatchPattern":"try {\n  await parseMediaStream({src: url});\n} catch (err) {\n  if (err instanceof Error && err.message.endsWith('not supported') && err.message.startsWith('File type')) {\n    // it is RIFF but not WAV/AVI (e.g. WebP) — route elsewhere\n  } else throw err;\n}","preventionTips":["Remember WebP and RF64 are RIFF but unsupported here.","Sniff bytes 8..12 to choose between WAV/AVI and reject others early.","Use ffprobe to confirm container subtype before parsing untrusted assets."],"tags":["riff","wav","avi","webp","unsupported-format","media-parser"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}