TeamNewPipe/NewPipe · error · NoSuchElementException

Cluster at {} without Timecode element

Error message

Cluster at {} without Timecode element

What it means

Thrown when readCluster() iterates the Cluster's child elements looking for the mandatory Timecode element (EBML ID_TIMECODE) and untilElement() returns null — meaning no Timecode child exists within the Cluster's declared bounds. In Matroska/WebM every Cluster must contain exactly one Timecode element giving the cluster's absolute timestamp; without it the block timecodes cannot be resolved to playback positions.

Source

Thrown at app/src/main/java/org/schabi/newpipe/streams/WebMReader.java:391

        obj.relativeTimeCode = stream.readShort();
        obj.flags = (byte) stream.read();
        obj.dataSize = (int) ((ref.offset + ref.size) - stream.position());
        obj.createdFromBlock = ref.type == ID_BLOCK;

        // NOTE: lacing is not implemented, and will be mixed with the stream data
        if (obj.dataSize < 0) {
            throw new IOException(String.format(
                    "Unexpected SimpleBlock element size, missing %s bytes", -obj.dataSize));
        }
        return obj;
    }

    private Cluster readCluster(final Element ref) throws IOException {
        final Cluster obj = new Cluster(ref);

        final Element elem = untilElement(ref, ID_TIMECODE);
        if (elem == null) {
            throw new NoSuchElementException("Cluster at " + ref.offset
                    + " without Timecode element");
        }
        obj.timecode = readNumber(elem);

        return obj;
    }

    static class Element {
        int type;
        long offset;
        long contentSize;
        long size;
    }

    public static class Info {
        public long timecodeScale;
        public long duration;
    }

View on GitHub (pinned to 9e8be09156)

Solutions

  1. Re-download or re-extract the source media — the Cluster is structurally invalid.
  2. Validate file integrity (hash/CRC) before demuxing if the file was transferred or cached.
  3. Catch NoSuchElementException at the demux boundary and report the file as corrupt to the user.
  4. If writing/muxing WebM, ensure every Cluster contains exactly one Timecode element as the first child.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Cluster cluster = readCluster(elem);
} catch (NoSuchElementException e) {
    if (e.getMessage() != null && e.getMessage().contains("without Timecode element")) {
        // corrupt cluster — skip or abort demux
        throw new IOException("Corrupt WebM cluster: missing Timecode at " + elem.offset, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: readCluster() calls untilElement(ref, ID_TIMECODE); the loop exhausts the Cluster element's content range without matching ID_TIMECODE, returning null; the null-check at line 390 throws. Caused by a Cluster element whose only/all children are SimpleBlock or BlockGroup elements with no Timecode, or a corrupted element-size field that made the scanner skip over the Timecode bytes.

Common situations: Corrupt or hand-edited WebM file missing the Timecode child; truncated cluster where the Timecode bytes were cut off; a remuxer bug that dropped the Timecode element; misaligned parse from a previous element causing the reader to start mid-Cluster.

Related errors


AI-assisted analysis of TeamNewPipe/NewPipe@9e8be09156 (2026-08-14). Data as JSON: /api/errors/37700ec2031c8a54. Report an issue: GitHub.