{"record":{"id":"3fca30639049fa2a","repo":"apache/hadoop","slug":"compression-codec-was-not-found","errorCode":null,"errorMessage":"Compression codec {} was not found.","messagePattern":"Compression codec (.+?) was not found\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/FileOutputFormat.java","lineNumber":99,"sourceCode":"   * @param conf the {@link JobConf} to look in\n   * @param defaultValue the {@link CompressionCodec} to return if not set\n   * @return the {@link CompressionCodec} to be used to compress the \n   *         job outputs\n   * @throws IllegalArgumentException if the class was specified, but not found\n   */\n  public static Class<? extends CompressionCodec> \n  getOutputCompressorClass(JobConf conf, \n\t\t                       Class<? extends CompressionCodec> defaultValue) {\n    Class<? extends CompressionCodec> codecClass = defaultValue;\n    \n    String name = conf.get(org.apache.hadoop.mapreduce.lib.output.\n      FileOutputFormat.COMPRESS_CODEC);\n    if (name != null) {\n      try {\n        codecClass = \n        \tconf.getClassByName(name).asSubclass(CompressionCodec.class);\n      } catch (ClassNotFoundException e) {\n        throw new IllegalArgumentException(\"Compression codec \" + name + \n                                           \" was not found.\", e);\n      }\n    }\n    return codecClass;\n  }\n  \n  public abstract RecordWriter<K, V> getRecordWriter(FileSystem ignored,\n                                               JobConf job, String name,\n                                               Progressable progress)\n    throws IOException;\n\n  public void checkOutputSpecs(FileSystem ignored, JobConf job) \n    throws FileAlreadyExistsException, \n           InvalidJobConfException, IOException {\n    // Ensure that the output directory is set and not already there\n    Path outDir = getOutputPath(job);\n    if (outDir == null && job.getNumReduceTasks() != 0) {\n      throw new InvalidJobConfException(\"Output directory not set in JobConf.\");","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/FileOutputFormat.java#L81-L117","documentation":"Error \"Compression codec {} was not found.\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/FileOutputFormat.java:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set mapreduce.output.fileoutputformat.compress.codec to a codec class on the classpath, e.g. org.apache.hadoop.io.compress.GzipCodec or DefaultCodec.","If compression is not required, set mapreduce.output.fileoutputformat.compress to false."],"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"}