{"record":{"id":"4025d459ef636021","repo":"remotion-dev/remotion","slug":"no-video-section-defined","errorCode":null,"errorMessage":"No video section defined","messagePattern":"No video section defined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/iso-base-media/get-seeking-byte-from-fragmented-mp4.ts","lineNumber":182,"sourceCode":"\t\t\tposition: currentPosition,\n\t\t\tmediaSections: info.mediaSections,\n\t\t}) !== 'in-section'\n\t) {\n\t\treturn {\n\t\t\ttype: 'valid-but-must-wait',\n\t\t};\n\t}\n\n\tLog.trace(\n\t\tlogLevel,\n\t\t'Fragmented MP4 - Inside the wrong video section, skipping to the end of the section',\n\t);\n\tconst mediaSection = getCurrentMediaSection({\n\t\toffset: currentPosition,\n\t\tmediaSections: info.mediaSections,\n\t});\n\tif (!mediaSection) {\n\t\tthrow new Error('No video section defined');\n\t}\n\n\treturn {\n\t\ttype: 'intermediary-seek',\n\t\tbyte: mediaSection.start + mediaSection.size,\n\t};\n};\n","sourceCodeStart":164,"sourceCodeEnd":190,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/iso-base-media/get-seeking-byte-from-fragmented-mp4.ts#L164-L190","documentation":"Thrown by getSeekingByteFromFragmentedMp4 in the fallback branch: after no seeking info matched and the current byte position is reportedly inside a media section, getCurrentMediaSection returns null. This means the mediaSections list does not actually contain the currentPosition even though isByteInMediaSection returned 'in-section' just above — an internal inconsistency, or the section list was mutated between the two checks.","triggerScenarios":"Reached only when isByteInMediaSection reported the position is in a section but getCurrentMediaSection (which finds the specific section) returns null. Practically indicates a state mutation race: mediaSections changed between the two reads, or getCurrentMediaSection uses stricter bounds than isByteInMediaSection.","commonSituations":"Concurrent reads on a parser instance not designed for concurrency. mediaSections being pruned/shifted by another part of the parser between checks. A logic bug where the two helpers disagree on boundary conditions (e.g. inclusive vs exclusive end).","solutions":["Do not drive a single media-parser instance from multiple concurrent callers; serialize seek/parse operations.","Capture a snapshot of mediaSections and pass the same array to both isByteInMediaSection and getCurrentMediaSection.","Report a media-parser bug if this reproduces on a single-threaded call sequence — include the file and seek time.","Retry the seek; transient if mediaSections is being populated incrementally."],"exampleFix":"// before\nawait parser.seek(time);\n\n// after\n// Serialize seeks and capture section snapshot externally if driving manually\nconst sections = parser.getSeekingHints?.().mediaSections ?? [];\nif (!sections.length) {\n  // wait for media sections to be discovered before seeking\n  await waitForFirstMdat();\n}\nawait parser.seek(time);","handlingStrategy":"retry","validationCode":"// Ensure mediaSections is non-empty and stable before seeking\nfunction hasMediaSections(sections: { start: number; size: number }[]): boolean {\n  return Array.isArray(sections) && sections.length > 0;\n}","typeGuard":"import type {MediaSection} from '../../state/video-section';\nfunction currentPositionHasSection(pos: number, sections: MediaSection[]): boolean {\n  return sections.some((s) => pos >= s.start && pos < s.start + s.size);\n}","tryCatchPattern":"try {\n  await parser.seek(time);\n} catch (err) {\n  if (/No video section defined/i.test(String(err?.message))) {\n    // mediaSections may still be populating; wait for the next mdat then retry\n    await waitForNextMdat();\n    return parser.seek(time);\n  }\n  throw err;\n}","preventionTips":["Serialize seek operations on a single parser instance — do not call concurrently.","Wait until at least one mdat/media section has been registered before seeking.","Snapshot mediaSections once and reuse the same reference for both section checks.","Report a bug if this reproduces under single-threaded usage."],"tags":["mp4","isobmff","media-parser","fmp4","seeking","media-section","race-condition"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}