{"record":{"id":"8b1a0dd396c0206f","repo":"DrKLO/Telegram","slug":"initialization-data-must-be-of-length-1","errorCode":null,"errorMessage":"Initialization data must be of length 1","messagePattern":"Initialization data must be of length 1","errorType":"exception","errorClass":"FlacDecoderException","httpStatus":null,"severity":"error","filePath":"TMessagesProj/src/main/java/com/google/android/exoplayer2/ext/flac/FlacDecoder.java","lineNumber":60,"sourceCode":"   * Creates a Flac decoder.\n   *\n   * @param numInputBuffers The number of input buffers.\n   * @param numOutputBuffers The number of output buffers.\n   * @param maxInputBufferSize The maximum required input buffer size if known, or {@link\n   *     Format#NO_VALUE} otherwise.\n   * @param initializationData Codec-specific initialization data. It should contain only one entry\n   *     which is the flac file header.\n   * @throws FlacDecoderException Thrown if an exception occurs when initializing the decoder.\n   */\n  public FlacDecoder(\n      int numInputBuffers,\n      int numOutputBuffers,\n      int maxInputBufferSize,\n      List<byte[]> initializationData)\n      throws FlacDecoderException {\n    super(new DecoderInputBuffer[numInputBuffers], new SimpleDecoderOutputBuffer[numOutputBuffers]);\n    if (initializationData.size() != 1) {\n      throw new FlacDecoderException(\"Initialization data must be of length 1\");\n    }\n    decoderJni = new FlacDecoderJni();\n    decoderJni.setData(ByteBuffer.wrap(initializationData.get(0)));\n    try {\n      streamMetadata = decoderJni.decodeStreamMetadata();\n    } catch (ParserException e) {\n      throw new FlacDecoderException(\"Failed to decode StreamInfo\", e);\n    } catch (IOException e) {\n      // Never happens.\n      throw new IllegalStateException(e);\n    }\n\n    int initialInputBufferSize =\n        maxInputBufferSize != Format.NO_VALUE ? maxInputBufferSize : streamMetadata.maxFrameSize;\n    setInitialInputBufferSize(initialInputBufferSize);\n  }\n\n  @Override","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/DrKLO/Telegram/blob/45ab8f4308496e1f01026a97fcdb0d58a5274474/TMessagesProj/src/main/java/com/google/android/exoplayer2/ext/flac/FlacDecoder.java#L42-L78","documentation":"FlacDecoder's constructor throws FlacDecoderException('Initialization data must be of length 1') unless the initializationData list contains exactly one entry — that entry being the FLAC file/stream header used to bootstrap the native decoder. Any other length means the decoder cannot locate the stream header.","triggerScenarios":"Constructing FlacDecoder with an initializationData list whose size() != 1 (zero entries, or more than one entry, e.g. because multiple headers were collected).","commonSituations":"A FLAC extractor or source providing zero or multiple initialization entries; a malformed FLAC stream whose header was split or absent; feeding non-FLAC initialization data.","solutions":["Ensure the FLAC extractor supplies exactly one initialization entry containing the full FLAC stream header.","Validate initializationData.size()==1 before instantiating FlacDecoder.","Use the platform FLAC decoder or re-extract the stream if the header cannot be supplied as a single entry."],"exampleFix":"// before\nnew FlacDecoder(nIn, nOut, maxIn, /* size 0 or 2 */ init);\n\n// after\ncheckArgument(init.size() == 1, \"FLAC init must be a single header entry\");\nnew FlacDecoder(nIn, nOut, maxIn, init);","handlingStrategy":"validation","validationCode":"// enforce the single-entry invariant before constructing\ncheckArgument(initializationData.size() == 1,\n    \"FLAC init must contain exactly one header entry\");\nnew FlacDecoder(nIn, nOut, maxIn, initializationData);","typeGuard":null,"tryCatchPattern":"try { new FlacDecoder(nIn, nOut, maxIn, init); }\ncatch (FlacDecoderException e) { /* fall back to platform FLAC decoder */ }","preventionTips":["Use the FLAC extractor to produce exactly one header entry.","Validate init size before instantiation.","Never synthesize multiple init entries for FLAC."],"tags":["audio","exoplayer","flac","decoder","initialization-data","validation"],"backgroundTag":null,"analyzedSha":"45ab8f4308496e1f01026a97fcdb0d58a5274474","analyzedAt":"2026-08-14T05:19:30.815Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}