{"record":{"id":"9d696786307786d8","repo":"remotion-dev/remotion","slug":"the-mediaparsercontroller-was-not-yet-used-in-a","errorCode":null,"errorMessage":"The mediaParserController() was not yet used in a parseMedia() call","messagePattern":"The mediaParserController\\(\\) was not yet used in a parseMedia\\(\\) call","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/controller/media-parser-controller.ts","lineNumber":67,"sourceCode":"\t\t\tconst err = new MediaParserAbortError('Aborted');\n\t\t\tif (abortController.signal.reason) {\n\t\t\t\terr.cause = abortController.signal.reason;\n\t\t\t}\n\n\t\t\tthrow err;\n\t\t}\n\n\t\tawait pauseSignal.waitUntilResume();\n\t};\n\n\tlet seekingHintResolution: (() => Promise<SeekingHints | null>) | null = null;\n\tlet simulateSeekResolution:\n\t\t| ((seekInSeconds: number) => Promise<SeekResolution>)\n\t\t| null = null;\n\n\tconst getSeekingHints = () => {\n\t\tif (!seekingHintResolution) {\n\t\t\tthrow new Error(\n\t\t\t\t'The mediaParserController() was not yet used in a parseMedia() call',\n\t\t\t);\n\t\t}\n\n\t\treturn seekingHintResolution();\n\t};\n\n\tconst simulateSeek = (seekInSeconds: number) => {\n\t\tif (!simulateSeekResolution) {\n\t\t\tthrow new Error(\n\t\t\t\t'The mediaParserController() was not yet used in a parseMedia() call',\n\t\t\t);\n\t\t}\n\n\t\treturn simulateSeekResolution(seekInSeconds);\n\t};\n\n\tconst attachSeekingHintResolution = (","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/controller/media-parser-controller.ts#L49-L85","documentation":"Thrown by MediaParserController.getSeekingHints() when the controller has never been registered with a parseMedia() call. The controller only learns the seeking-hints resolver through an internal callback that parseMedia attaches (attachSeekingHintResolution); before that the resolver is null and the method refuses to run. It exists to give a clear message instead of a null-reference failure.","triggerScenarios":"Creating a controller via mediaParserController() and calling controller.getSeekingHints() before passing that controller into parseMedia({controller}). Also calling it after parseMedia has completed and been torn down without a fresh registration.","commonSituations":"Inspecting seeking hints for UI/seek-bar setup before kicking off the parse loop. Reusing a controller object across a re-render lifecycle where the previous parseMedia already finished. Forgetting to pass the controller option to parseMedia.","solutions":["Pass the controller to parseMedia first: parseMedia({src, controller, fields}) and only call getSeekingHints() once parsing has started.","Call getSeekingHints() from within an event listener (e.g. after the first sample or duration event) so registration is guaranteed.","Create a fresh mediaParserController() for each independent parseMedia run; never share one across runs."],"exampleFix":"// before\nconst controller = mediaParserController();\nconst hints = await controller.getSeekingHints();\n\n// after\nconst controller = mediaParserController();\nparseMedia({src: '/video.mp4', controller, fields: {duration: true}});\ncontroller.addEventListener('tracks', () => {\n  controller.getSeekingHints().then(hints => console.log(hints));\n});","handlingStrategy":"validation","validationCode":"const controller = mediaParserController();\nlet registered = false;\ncontroller.addEventListener('tracks', () => { registered = true; });\nparseMedia({src, controller, fields: {duration: true}});\n// only call after parseMedia has started\nif (registered) await controller.getSeekingHints();","typeGuard":"null","tryCatchPattern":"try { await controller.getSeekingHints(); } catch (e) { if (e.message.includes('not yet used')) { /* defer until parseMedia starts */ } else throw e; }","preventionTips":["Pass the controller to parseMedia before calling any controller read method.","Call getSeekingHints from inside an event listener fired during parsing.","Create one controller per parseMedia run."],"tags":["controller","seeking","api-misuse","lifecycle"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}