{"record":{"id":"62a37d71777bcf7f","repo":"TeamNewPipe/NewPipe","slug":"element-timecode-not-found","errorCode":null,"errorMessage":"Element Timecode not found","messagePattern":"Element Timecode not found","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/org/schabi/newpipe/streams/WebMReader.java","lineNumber":267,"sourceCode":"\n    private Info readInfo(final Element ref) throws IOException {\n        Element elem;\n        final Info info = new Info();\n\n        while ((elem = untilElement(ref, ID_TIMECODE_SCALE, ID_DURATION)) != null) {\n            switch (elem.type) {\n                case ID_TIMECODE_SCALE:\n                    info.timecodeScale = readNumber(elem);\n                    break;\n                case ID_DURATION:\n                    info.duration = readNumber(elem);\n                    break;\n            }\n            ensure(elem);\n        }\n\n        if (info.timecodeScale == 0) {\n            throw new NoSuchElementException(\"Element Timecode not found\");\n        }\n\n        return info;\n    }\n\n    private Segment readSegment(final Element ref, final int trackLacingExpected,\n                                final boolean metadataExpected) throws IOException {\n        final Segment obj = new Segment(ref);\n        Element elem;\n        while ((elem = untilElement(ref, ID_INFO, ID_TRACKS, ID_CLUSTER)) != null) {\n            if (elem.type == ID_CLUSTER) {\n                obj.currentCluster = elem;\n                break;\n            }\n            switch (elem.type) {\n                case ID_INFO:\n                    obj.info = readInfo(elem);\n                    break;","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/TeamNewPipe/NewPipe/blob/9e8be091560a69f35d44bd252eb00bc7911c977b/app/src/main/java/org/schabi/newpipe/streams/WebMReader.java#L249-L285","documentation":"WebMReader parses the Segment Info element and expects a TimecodeScale child (which converts segment timecodes to nanoseconds). After scanning Info, if info.timecodeScale is still 0 it throws NoSuchElementException 'Element Timecode not found'. Without a timecode scale, duration math is impossible, so the segment is rejected.","triggerScenarios":"Parsing a WebM whose Segment Info element lacks the TimecodeScale child, or where the Info element is absent/empty. The reader requires TimecodeScale to interpret all cluster/block timestamps.","commonSituations":"A malformed WebM missing the TimecodeScale element; a file produced by a non-conformant muxer that omits it; a truncated Info element; a manually constructed Matroska missing required metadata.","solutions":["Use a well-formed WebM source — TimecodeScale is mandatory in the spec and any conformant file has it.","Re-mux with ffmpeg/ffmpeg -f webm to regenerate the Info element with TimecodeScale.","Pre-scan the Info element for TimecodeScale before fully parsing.","Validate the file with mkvinfo to confirm Info/TimecodeScale is present."],"exampleFix":"// before\nnew WebMReader(malformedWebM).parse(); // throws: TimecodeScale missing\n\n// after — remux to guarantee required metadata\nffmpeg -i in.webm -c copy -f webm out.webm\nnew WebMReader(outWebM).parse();","handlingStrategy":"validation","validationCode":"// Pre-scan the Segment Info element for a TimecodeScale child before full parse.\n// Easiest: validate with mkvinfo that Info/TimecodeScale is present,\n// or remux with ffmpeg -f webm to guarantee required metadata.","typeGuard":"public static boolean hasTimecodeScale(SegmentInfo info) {\n    return info != null && info.timecodeScale != 0;\n}","tryCatchPattern":"try {\n    reader.parse();\n} catch (NoSuchElementException e) {\n    if (e.getMessage().contains(\"Timecode not found\")) {\n        // Info lacks TimecodeScale — re-mux to repair metadata\n        remuxWithFfmpegWebM();\n    } else throw e;\n}","preventionTips":["Use well-formed WebM sources — TimecodeScale is spec-mandatory.","Re-mux malformed sources with ffmpeg -f webm.","Pre-scan Info for TimecodeScale before deep parsing.","Validate with mkvinfo that Info/TimecodeScale exists."],"tags":["webm","ebml","metadata","missing-metadata","java"],"backgroundTag":null,"analyzedSha":"9e8be091560a69f35d44bd252eb00bc7911c977b","analyzedAt":"2026-08-14T00:11:33.519Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}