{"record":{"id":"f8de9778fb69cb76","repo":"remotion-dev/remotion","slug":"reached-the-end-of-the-file-even-though-a-seek-was","errorCode":null,"errorMessage":"Reached the end of the file even though a seek was requested. 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":"Reached the end of the file even though a seek was requested\\. 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":191,"sourceCode":"\t\tif (!didProgress) {\n\t\t\titerationWithThisOffset++;\n\t\t} else {\n\t\t\titerationWithThisOffset = 0;\n\t\t}\n\t}\n\n\tstate.samplesObserved.setLastSampleObserved();\n\tawait state.callbacks.callTracksDoneCallback();\n\n\t// After the last sample, you might queue a last seek again.\n\tif (state.controller._internals.seekSignal.getSeek() !== null) {\n\t\tLog.verbose(\n\t\t\tstate.logLevel,\n\t\t\t'Reached end of samples, but there is a pending seek. Trying to seek...',\n\t\t);\n\t\tawait workOnSeekRequest(getWorkOnSeekRequestOptions(state));\n\t\tif (state.controller._internals.seekSignal.getSeek() !== null) {\n\t\t\tthrow new Error(\n\t\t\t\t'Reached the end of the file even though a seek was requested. 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);\n\t\t}\n\n\t\tawait parseLoop({\n\t\t\tonError,\n\t\t\tthrottledState,\n\t\t\tstate,\n\t\t});\n\t}\n};\n","sourceCodeStart":173,"sourceCodeEnd":203,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/parse-loop.ts#L173-L203","documentation":"After the final sample is observed, parseLoop checks whether a seek is still pending (controller seekSignal). If so it calls workOnSeekRequest; if the seek is STILL pending afterward, the parser throws because seeking past EOF is unrecoverable and indicates an internal bug. The message directs users to report it.","triggerScenarios":"A seek request was queued (user-initiated or parser-internal) that could not be satisfied before the file ended — e.g. a malformed sample table pointing beyond EOF, or a seek computed against an incorrect content length. Defensive guard, not typically user-fixable.","commonSituations":"Corrupt MP4/Matroska sample tables, truncated downloads where the tail is missing, or parser bugs computing seek targets. Rare in well-formed media.","solutions":["Report the file at https://remotion.dev/report.","Re-download the source fully (verify size/checksum) in case it was truncated.","Re-mux/re-encode to rebuild sample tables (`ffmpeg -i in -c copy out.mp4`).","If you are issuing manual seeks via the controller, ensure the seek target is within the media duration."],"exampleFix":"// before\nawait parseMedia({src: truncated, fields: {durationInSeconds: true}});\n\n// after: re-fetch fully + re-mux\n// curl -o full.mp4 <url>  (verify size matches Content-Length)\n// ffmpeg -i full.mp4 -c copy repaired.mp4\nawait parseMedia({src: 'repaired.mp4', fields: {durationInSeconds: true}});","handlingStrategy":"try-catch","validationCode":"import {execFileSync} from 'node:child_process';\nfunction isComplete(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('Reached the end of the file')) {\n    // re-download fully / re-mux; otherwise report upstream\n    throw new Error('Asset appears truncated or has a corrupt sample table');\n  }\n  throw e;\n}","preventionTips":["Verify downloads completed (size/checksum vs Content-Length) before parsing.","Re-mux to rebuild sample tables when in doubt.","Keep manual controller seeks within the media duration.","Report reproducible cases at https://remotion.dev/report."],"tags":["media-parser","internal-bug","seeking","corrupt-file"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}