{"record":{"id":"c2aa173b06b7802b","repo":"apache/hadoop","slug":"stored-gzip-size-doesn-t-match-decompressed-size","errorCode":null,"errorMessage":"stored gzip size doesn't match decompressed size","messagePattern":"stored gzip size doesn't match decompressed size","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipDecompressor.java","lineNumber":405,"sourceCode":"        crc.reset();\n        state = GzipStateLabel.TRAILER_SIZE;\n      }\n    }\n\n    if (userBufLen <= 0) {\n      return;\n    }\n\n    // verify that the mod-2^32 decompressed stream size matches the value\n    // stored in the gzip trailer\n    if (state == GzipStateLabel.TRAILER_SIZE) {\n      assert (localBufOff < 4);  // initially 0, but may need multiple calls\n      int n = Math.min(userBufLen, 4-localBufOff);\n      copyBytesToLocal(n);       // modifies userBufLen, etc.\n      if (localBufOff >= 4) {    // should be strictly ==\n        long inputSize = readUIntLE(localBuf, 0);\n        if (inputSize != (inflater.getBytesWritten() & 0xffffffffL)) {\n          throw new IOException(\n            \"stored gzip size doesn't match decompressed size\");\n        }\n        localBufOff = 0;\n        state = GzipStateLabel.FINISHED;\n      }\n    }\n\n    if (state == GzipStateLabel.FINISHED) {\n      return;\n    }\n  }\n\n  /**\n   * Returns the total number of compressed bytes input so far, including\n   * gzip header/trailer bytes.\n   *\n   * @return the total (non-negative) number of compressed bytes read so far\n   */","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipDecompressor.java#L387-L423","documentation":"Error \"stored gzip size doesn't match decompressed size\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipDecompressor.java:405 when the library encounters an invalid state.","commonSituations":"Occurs when the size stored in the gzip trailer does not match the bytes actually decompressed, usually due to corruption or truncation. Validate the source file and treat as unrecoverable corrupt input.","solutions":["The ISIZE trailer does not match the decompressed byte count; the file is truncated or corrupt. Re-obtain the file.","Make sure the writer closed the GZIPOutputStream so the trailer was written correctly."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}