TeamNewPipe/NewPipe · error · RuntimeException
Cluster element found without Info and/or Tracks element at
Error message
Cluster element found without Info and/or Tracks element at position {} What it means
Thrown by WebMReader when parsing a Matroska/WebM Segment element: the parser encountered a Cluster (the media-data container) before it saw the required Info and/or Tracks metadata elements. In a well-formed WebM file the Info element (codec/duration/timecode-scale metadata) and Tracks element (stream descriptions) must precede the first Cluster. The reader only sets metadataExpected when it knows the segment is not a live stream, so this fires on structurally invalid or truncated files where the metadata section is missing or was cut off before the Cluster began.
Source
Thrown at app/src/main/java/org/schabi/newpipe/streams/WebMReader.java:294
Element elem;
while ((elem = untilElement(ref, ID_INFO, ID_TRACKS, ID_CLUSTER)) != null) {
if (elem.type == ID_CLUSTER) {
obj.currentCluster = elem;
break;
}
switch (elem.type) {
case ID_INFO:
obj.info = readInfo(elem);
break;
case ID_TRACKS:
obj.tracks = readTracks(elem, trackLacingExpected);
break;
}
ensure(elem);
}
if (metadataExpected && (obj.info == null || obj.tracks == null)) {
throw new RuntimeException(
"Cluster element found without Info and/or Tracks element at position "
+ ref.offset);
}
return obj;
}
private WebMTrack[] readTracks(final Element ref, final int lacingExpected) throws IOException {
final ArrayList<WebMTrack> trackEntries = new ArrayList<>(2);
Element elemTrackEntry;
while ((elemTrackEntry = untilElement(ref, ID_TRACK_ENTRY)) != null) {
final WebMTrack entry = new WebMTrack();
boolean drop = false;
Element elem;
while ((elem = untilElement(elemTrackEntry)) != null) {
switch (elem.type) {
case ID_TRACK_NUMBER:View on GitHub (pinned to 9e8be09156)
Solutions
- Validate the source file is complete and well-formed before feeding it to WebMReader (check download finished, file size matches expected Content-Length).
- Re-download or re-extract the stream: the metadata section was missing or truncated, indicating the source file is damaged.
- If reading a live stream or segment that legitimately omits metadata, construct the reader so metadataExpected is false (the overload that knows this is a continuation/live segment).
- Catch the RuntimeException at the call site and surface a user-facing 'media file is corrupt' message rather than crashing.
Example fix
// before — crashes on truncated downloads
WebMReader reader = new WebMReader(stream);
Segment segment = reader.parse();
// after — guard against corrupt/truncated media
try {
WebMReader reader = new WebMReader(stream);
Segment segment = reader.parse();
} catch (RuntimeException e) {
if (e.getMessage().contains("Cluster element found without")) {
throw new IOException("Corrupt WebM file: missing Info/Tracks metadata", e);
}
throw e;
} Defensive patterns
Strategy: validation
Validate before calling
// Verify the WebM stream has Info and Tracks before the first Cluster
// by doing a lightweight EBML pre-scan, or check file completeness:
if (streamFile.length() < minExpectedSize) {
throw new IOException("WebM source too small / likely truncated: " + streamFile.length());
} Try / catch
try {
WebMReader reader = new WebMReader(stream);
Segment seg = reader.parse();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("Cluster element found without")) {
// treat as corrupt/incomplete source — re-download or skip
throw new IOException("Corrupt WebM: missing Info/Tracks metadata", e);
}
throw e;
} Prevention
- Always verify a download completed fully (Content-Length matched) before demuxing.
- Validate WebM magic bytes (0x1A45DFA3) at the start of the file before parsing.
- Do not attempt to demux partial/live segments as full WebM files.
When it happens
Trigger: readSegment() is called with metadataExpected=true; the while-loop breaks on the first ID_CLUSTER element (line 278-281) before both obj.info and obj.tracks are populated; the post-loop check at line 293 finds one or both null and throws. This happens when the stream's Segment starts directly with a Cluster, or when Info/Tracks appear after the Cluster instead of before it.
Common situations: Downloading a truncated or partially-written WebM/Opus audio file (e.g. download interrupted mid-write); receiving a live DASH/HLS WebM adaptation that omits the head metadata when saved; a remuxing tool that reordered EBML elements incorrectly; corrupt media cache left over from a failed download.
Related errors
- Cluster at {} without Timecode element
- Unexpected SimpleBlock element size, missing %s bytes
- Truncated stream, missing {} bytes
- cannot get the audio sample rate
- missing default frame time
AI-assisted analysis of TeamNewPipe/NewPipe@9e8be09156 (2026-08-14).
Data as JSON: /api/errors/3e41ae2df87970f6.
Report an issue: GitHub.