{"record":{"id":"0fcafe20bf56b0a8","repo":"apache/hadoop","slug":"cannot-seek-in-codecname-compressed-stream-0fcafe","errorCode":null,"errorMessage":"Cannot seek in {codecName} compressed stream","messagePattern":"Cannot seek in (.+?) compressed stream","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/LineRecordReader.java","lineNumber":121,"sourceCode":"      CompressionCodec codec = new CompressionCodecFactory(job).getCodec(file);\n      if (null!=codec) {\n        isCompressedInput = true;\n        decompressor = CodecPool.getDecompressor(codec);\n        if (codec instanceof SplittableCompressionCodec) {\n          final SplitCompressionInputStream cIn =\n                  ((SplittableCompressionCodec)codec).createInputStream(\n                          fileIn, decompressor, start, end,\n                          SplittableCompressionCodec.READ_MODE.BYBLOCK);\n          in = new CompressedSplitLineReader(cIn, job,\n                  this.recordDelimiterBytes);\n          start = cIn.getAdjustedStart();\n          end = cIn.getAdjustedEnd();\n          filePosition = cIn;\n        } else {\n          if (start != 0) {\n            // So we have a split that is only part of a file stored using\n            // a Compression codec that cannot be split.\n            throw new IOException(\"Cannot seek in \" +\n                    codec.getClass().getSimpleName() + \" compressed stream\");\n          }\n\n          in = new SplitLineReader(codec.createInputStream(fileIn,\n                  decompressor), job, this.recordDelimiterBytes);\n          filePosition = fileIn;\n        }\n      } else {\n        fileIn.seek(start);\n        in = new UncompressedSplitLineReader(\n                fileIn, job, this.recordDelimiterBytes, split.getLength());\n        filePosition = fileIn;\n      }\n      // If this is not the first split, we always throw away first record\n      // because we always (except the last split) read one extra line in\n      // next() method.\n      if (start != 0) {\n        start += in.readLine(new Text(), 0, maxBytesToConsume(start));","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/LineRecordReader.java#L103-L139","documentation":"Error \"Cannot seek in {codecName} compressed stream\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/LineRecordReader.java:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a splittable codec (e.g. bzip2) for compressed input that must be seeked, or process the stream without seeking."],"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-23T01:17:44.959Z"}