{"record":{"id":"f867b22c9a952629","repo":"apache/hadoop","slug":"unknown-gzip-format-reserved-flagbits-set","errorCode":null,"errorMessage":"unknown gzip format (reserved flagbits set)","messagePattern":"unknown gzip format \\(reserved flagbits set\\)","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":518,"sourceCode":"   *   bit 0   FTEXT\n   *   bit 1   FHCRC   (never implemented in gzip, at least through version\n   *                   1.4.0; instead interpreted as \"continuation of multi-\n   *                   part gzip file,\" which is unsupported through 1.4.0)\n   *   bit 2   FEXTRA\n   *   bit 3   FNAME\n   *   bit 4   FCOMMENT\n   *  [bit 5   encrypted]\n   */\n  private void processBasicHeader() throws IOException {\n    if (readUShortLE(localBuf, 0) != GZIP_MAGIC_ID) {\n      throw new IOException(\"not a gzip file\");\n    }\n    if (readUByte(localBuf, 2) != GZIP_DEFLATE_METHOD) {\n      throw new IOException(\"gzip data not compressed with deflate method\");\n    }\n    int flg = readUByte(localBuf, 3);\n    if ((flg & GZIP_FLAGBITS_RESERVED) != 0) {\n      throw new IOException(\"unknown gzip format (reserved flagbits set)\");\n    }\n    hasExtraField = ((flg & GZIP_FLAGBIT_EXTRA_FIELD) != 0);\n    hasFilename   = ((flg & GZIP_FLAGBIT_FILENAME)    != 0);\n    hasComment    = ((flg & GZIP_FLAGBIT_COMMENT)     != 0);\n    hasHeaderCRC  = ((flg & GZIP_FLAGBIT_HEADER_CRC)  != 0);\n  }\n\n  private void checkAndCopyBytesToLocal(int len) {\n    System.arraycopy(userBuf, userBufOff, localBuf, localBufOff, len);\n    localBufOff += len;\n    // alternatively, could call checkAndSkipBytes(len) for rest...\n    crc.update(userBuf, userBufOff, len);\n    userBufOff += len;\n    userBufLen -= len;\n    headerBytesRead += len;\n  }\n\n  private void checkAndSkipBytes(int len) {","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipDecompressor.java#L500-L536","documentation":"Error \"unknown gzip format (reserved flagbits set)\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipDecompressor.java:518 when the library encounters an invalid state.","commonSituations":"Occurs when reserved flag bits are set in the gzip header, indicating a non-standard or corrupt file. Validate gzip headers of untrusted input before decompression.","solutions":["Reserved flag bits are set in the gzip header, indicating corruption or a non-conforming writer. Re-create the file with a standard gzip tool."],"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"}