{"record":{"id":"eff9231c98e28419","repo":"remotion-dev/remotion","slug":"could-not-find-track-tracknumber","errorCode":null,"errorMessage":"Could not find track ${trackNumber}","messagePattern":"Could not find track (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/get-sample-from-block.ts","lineNumber":83,"sourceCode":"\t\treturn;\n\t}\n\n\tconst missingTracks = getTracksFromMatroska({\n\t\tstructureState,\n\t\twebmState,\n\t}).missingInfo;\n\n\tif (missingTracks.length === 0) {\n\t\treturn;\n\t}\n\n\tconst parsed = parseAvc(partialVideoSample.data, avcState);\n\tfor (const parse of parsed) {\n\t\tif (parse.type === 'avc-profile') {\n\t\t\twebmState.setAvcProfileForTrackNumber(trackNumber, parse);\n\t\t\tconst track = missingTracks.find((t) => t.trackId === trackNumber);\n\t\t\tif (!track) {\n\t\t\t\tthrow new Error('Could not find track ' + trackNumber);\n\t\t\t}\n\n\t\t\tconst resolvedTracks = getTracksFromMatroska({\n\t\t\t\tstructureState,\n\t\t\t\twebmState,\n\t\t\t}).resolved;\n\t\t\tconst resolvedTrack = resolvedTracks.find(\n\t\t\t\t(t) => t.trackId === trackNumber,\n\t\t\t);\n\t\t\tif (!resolvedTrack) {\n\t\t\t\tthrow new Error('Could not find track ' + trackNumber);\n\t\t\t}\n\n\t\t\tawait registerVideoTrack({\n\t\t\t\ttrack: resolvedTrack,\n\t\t\t\tcontainer: 'webm',\n\t\t\t\tlogLevel,\n\t\t\t\tonVideoTrack,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/get-sample-from-block.ts#L65-L101","documentation":"Thrown in addAvcToTrackAndActivateTrackIfNecessary (get-sample-from-block.ts:83) during lazy AVC profile resolution. After parsing an AVC profile from a block, the code looks up the producing track in the `missingInfo` list; not finding it means the track that generated the AVC data was never registered as missing — an internal state inconsistency rather than a user-facing validation failure.","triggerScenarios":"Streaming/lazy parse of an AVC (H.264) WebM track whose CodecPrivate was absent (so the track sat in `missingInfo`), then the first keyframe is processed. Fires when the SPS-derived profile is set for a trackNumber that is no longer (or was never) in the `missingInfo` set returned by `getTracksFromMatroska` — e.g. concurrent/re-entrant resolution or a trackNumber mismatch between block and TrackEntry.","commonSituations":"AVC-in-WebM files with missing CodecPrivate where track numbering is unusual; races between sample parsing and track resolution state; bugs after refactors of `getTracksFromMatroska`. Should never occur for well-formed files and correct internal state.","solutions":["Treat as a bug report: capture the exact file and the call to `parseMedia()` and file it at https://remotion.dev/report.","Ensure you are on the latest @remotion/media-parser version; this path depends on tightly coupled internal state.","As an immediate workaround, catch the error and fall back to remuxing the file with ffmpeg so CodecPrivate is embedded (`ffmpeg -i in.webm -c copy out.mkv`)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-validate that the AVC track carries CodecPrivate — if it does,\n// this lazy-resolution path is never taken.\nimport { parseMedia } from '@remotion/media-parser';\nasync function isSafeAvcWebm(src) {\n  let sawAvc = false;\n  await parseMedia({\n    src,\n    fields: { tracks: true },\n    onVideoTrack: (track) => {\n      if (track.codecEnum === 'h264') sawAvc = true;\n      return track;\n    },\n  });\n  return !sawAvc; // safe only if no AVC track needs lazy resolution\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({ src, fields: { samples: true } });\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Could not find track ')) {\n    // Internal invariant break during AVC profile resolution.\n    // Re-mux to embed CodecPrivate, then retry.\n    console.error('AVC lazy-resolution failed for', src, '— re-mux the file.');\n  }\n  throw err;\n}","preventionTips":["Re-mux AVC-in-WebM files with ffmpeg so CodecPrivate (avcC) is embedded and lazy resolution is avoided.","Report reproducible files to Remotion — this path should be unreachable.","Keep @remotion/media-parser updated; the lazy-resolution state machine is actively maintained."],"tags":["media-parser","webm","avc","h264","internal-state","lazy-resolution"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}