{"record":{"id":"85546365b36f6af0","repo":"remotion-dev/remotion","slug":"no-pat-box-found","errorCode":null,"errorMessage":"No PAT box found","messagePattern":"No PAT box found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/transport-stream/traversal.ts","lineNumber":14,"sourceCode":"import type {TransportStreamStructure} from '../../parse-result';\nimport type {TransportStreamPATBox, TransportStreamPMTBox} from './boxes';\nimport type {TransportStreamProgramAssociationTableEntry} from './parse-pat';\nimport type {TransportStreamEntry} from './parse-pmt';\n\nconst findProgramAssociationTableOrThrow = (\n\tstructure: TransportStreamStructure,\n) => {\n\tconst box = structure.boxes.find(\n\t\t(b) => b.type === 'transport-stream-pat-box',\n\t);\n\n\tif (!box) {\n\t\tthrow new Error('No PAT box found');\n\t}\n\n\treturn box as TransportStreamPATBox;\n};\n\nexport const findProgramMapOrNull = (structure: TransportStreamStructure) => {\n\tconst box = structure.boxes.find(\n\t\t(b) => b.type === 'transport-stream-pmt-box',\n\t);\n\n\tif (!box) {\n\t\treturn null;\n\t}\n\n\treturn box as TransportStreamPMTBox;\n};\n\nexport const findProgramMapTableOrThrow = (","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/transport-stream/traversal.ts#L1-L32","documentation":"Thrown by findProgramAssociationTableOrThrow at traversal.ts:14 when structure.boxes contains no box of type 'transport-stream-pat-box'. The PAT box is produced by parsePat; if it has not been encountered yet (or at all), every traversal that needs program associations fails.","triggerScenarios":"findProgramAssociationTableOrThrow scans structure.boxes for the PAT type and throws if absent. Triggered when traversal runs before the PAT packet has been parsed, when the stream has no PAT (non-standard or corrupt), or when the PAT packet was dropped/lost.","commonSituations":"Partial captures missing the PAT packet; corrupt streams where the PAT PID (0x0000) carries no section; parser invoked too early before header packets are processed; non-conformant .ts files.","solutions":["Re-mux the file: ffmpeg -i in.ts -c copy out.ts to regenerate the PAT.","Ensure the input starts at a PAT packet (re-acquire from the source if needed).","Validate with ffprobe that a PAT is present.","File a bug with a sample if the stream contains a PAT but the library does not detect it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm a PAT packet is present before parsing\nimport {execSync} from 'node:child_process';\nfunction hasTransportStreamPat(src: string): boolean {\n  try { execSync(`ffprobe -v error -i \"${src}\" -t 1 -f null -`, {stdio: 'ignore'}); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try { await parseMedia({src}); }\ncatch (e) {\n  if (e instanceof Error && e.message === 'No PAT box found') {\n    await runFfmpeg(['-i', src, '-c', 'copy', src + '.remux.ts']);\n    await parseMedia({src: src + '.remux.ts'});\n  } else throw e;\n}","preventionTips":["Ensure .ts inputs start at a PAT packet.","Re-mux with ffmpeg to regenerate PAT/PMT.","Validate with ffprobe that the PAT is present."],"tags":["media-parser","transport-stream","mpegts","pat","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}