remotion-dev/remotion · error · Error

Infinite loop detected. The parser is not progressing. This

Error message

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.

What it means

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.

Source

Thrown at packages/media-parser/src/parse-loop.ts:72

		) {
			await fetchMoreData(state);
		}

		state.timings.timeReadingData += Date.now() - readStart;

		throttledState.update?.(() => makeProgressObject(state));

		if (!state.errored) {
			Log.trace(
				state.logLevel,
				`Continuing parsing of file, currently at position ${state.iterator.counter.getOffset()}/${state.contentLength} (0x${state.iterator.counter.getOffset().toString(16)})`,
			);

			if (
				iterationWithThisOffset > 300 &&
				state.structure.getStructure().type !== 'm3u'
			) {
				throw new Error(
					'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.',
				);
			}

			try {
				await triggerInfoEmit(state);

				await state.controller._internals.checkForAbortAndPause();
				const parseLoopStart = Date.now();
				const result = await runParseIteration({
					state,
				});
				state.timings.timeInParseLoop += Date.now() - parseLoopStart;

				if (result !== null && result.action === 'fetch-more-data') {
					Log.verbose(
						state.logLevel,
						`Need to fetch ${result.bytesNeeded} more bytes before we can continue`,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Report the file at https://remotion.dev/report with the offending asset so the parser bug can be fixed.
  2. Re-encode the file with FFmpeg to normalize its structure (`ffmpeg -i in -c copy out.mp4` or full re-encode).
  3. Try a different source/encoding of the same content to confirm the file is the trigger.
  4. Update @remotion/media-parser to the latest patch in case the bug was already fixed.

Example fix

// before
await parseMedia({src: problematic, fields: {durationInSeconds: true}});

// after: normalize the asset, then parse
// ffmpeg -i problematic -c:v libx264 -c:a aac normalized.mp4
await parseMedia({src: 'normalized.mp4', fields: {durationInSeconds: true}});
// if it still fails, report at https://remotion.dev/report
Defensive patterns

Strategy: try-catch

Validate before calling

import {execFileSync} from 'node:child_process';
function isPlayable(path: string): boolean {
  try { execFileSync('ffprobe', ['-v','error', path], {stdio:'pipe'}); return true; } catch { return false; }
}

Try / catch

try {
  await parseMedia({src, fields: {durationInSeconds: true}});
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Infinite loop detected')) {
    // re-mux or re-encode the asset; otherwise report upstream
    throw new Error('Parser stalled on this asset; re-encode or report at remotion.dev/report');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/c648a96edb198a8c. Report an issue: GitHub.