{"record":{"id":"c648a96edb198a8c","repo":"remotion-dev/remotion","slug":"infinite-loop-detected-the-parser-is-not-progress","errorCode":null,"errorMessage":"Infinite loop detected. The parser is not progressing. This is likely a bug in the parser. You can report this at https://remotion.dev/report and we will fix it as soon as possible.","messagePattern":"Infinite loop detected\\. The parser is not progressing\\. This is likely a bug in the parser\\. You can report this at https://remotion\\.dev/report and we will fix it as soon as possible\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/parse-loop.ts","lineNumber":72,"sourceCode":"\t\t) {\n\t\t\tawait fetchMoreData(state);\n\t\t}\n\n\t\tstate.timings.timeReadingData += Date.now() - readStart;\n\n\t\tthrottledState.update?.(() => makeProgressObject(state));\n\n\t\tif (!state.errored) {\n\t\t\tLog.trace(\n\t\t\t\tstate.logLevel,\n\t\t\t\t`Continuing parsing of file, currently at position ${state.iterator.counter.getOffset()}/${state.contentLength} (0x${state.iterator.counter.getOffset().toString(16)})`,\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\titerationWithThisOffset > 300 &&\n\t\t\t\tstate.structure.getStructure().type !== 'm3u'\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Infinite loop detected. The parser is not progressing. This is likely a bug in the parser. You can report this at https://remotion.dev/report and we will fix it as soon as possible.',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait triggerInfoEmit(state);\n\n\t\t\t\tawait state.controller._internals.checkForAbortAndPause();\n\t\t\t\tconst parseLoopStart = Date.now();\n\t\t\t\tconst result = await runParseIteration({\n\t\t\t\t\tstate,\n\t\t\t\t});\n\t\t\t\tstate.timings.timeInParseLoop += Date.now() - parseLoopStart;\n\n\t\t\t\tif (result !== null && result.action === 'fetch-more-data') {\n\t\t\t\t\tLog.verbose(\n\t\t\t\t\t\tstate.logLevel,\n\t\t\t\t\t\t`Need to fetch ${result.bytesNeeded} more bytes before we can continue`,","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/parse-loop.ts#L54-L90","documentation":"parseLoop tracks iterationWithThisOffset: it increments when the iterator offset did not advance between iterations. If it exceeds 300 and the structure is not m3u (where stalling is expected), the parser throws to avoid a true infinite loop. The message explicitly says it is most likely a bug in the parser and asks for a report.","triggerScenarios":"Any media file/format combination where runParseIteration keeps returning without advancing the byte cursor — e.g. an unrecognized box that the parser skips length-zero, a malformed structure causing repeated fetch-more-data loops, or a seek that lands back on the same offset.","commonSituations":"A genuinely novel or corrupt file the parser doesn't handle; rare regressions after parser changes; concatenated/partial files with garbage bytes the parser keeps re-reading. This is a defensive guard, not normally user-fixable.","solutions":["Report the file at https://remotion.dev/report with the offending asset so the parser bug can be fixed.","Re-encode the file with FFmpeg to normalize its structure (`ffmpeg -i in -c copy out.mp4` or full re-encode).","Try a different source/encoding of the same content to confirm the file is the trigger.","Update @remotion/media-parser to the latest patch in case the bug was already fixed."],"exampleFix":"// before\nawait parseMedia({src: problematic, fields: {durationInSeconds: true}});\n\n// after: normalize the asset, then parse\n// ffmpeg -i problematic -c:v libx264 -c:a aac normalized.mp4\nawait parseMedia({src: 'normalized.mp4', fields: {durationInSeconds: true}});\n// if it still fails, report at https://remotion.dev/report","handlingStrategy":"try-catch","validationCode":"import {execFileSync} from 'node:child_process';\nfunction isPlayable(path: string): boolean {\n  try { execFileSync('ffprobe', ['-v','error', path], {stdio:'pipe'}); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Infinite loop detected')) {\n    // re-mux or re-encode the asset; otherwise report upstream\n    throw new Error('Parser stalled on this asset; re-encode or report at remotion.dev/report');\n  }\n  throw e;\n}","preventionTips":["Re-mux/re-encode exotic or corrupt assets before parsing.","Keep @remotion/media-parser updated for parser bug fixes.","Report reproducible stalls at https://remotion.dev/report.","Validate files with ffprobe as a sanity gate."],"tags":["media-parser","internal-bug","infinite-loop","corrupt-file"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}