apache/hadoop · error · IOException

Not a supported codec: {}

Error message

Not a supported codec: {}

What it means

Error "Not a supported codec: {}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java:103

    String codecClassName = conf.get(
      DFSConfigKeys.DFS_IMAGE_COMPRESSION_CODEC_KEY,
      DFSConfigKeys.DFS_IMAGE_COMPRESSION_CODEC_DEFAULT);
    return createCompression(conf, codecClassName);
  }

  /**
   * Create a compression instance using the codec specified by
   * <code>codecClassName</code>
   */
  static FSImageCompression createCompression(Configuration conf,
                                                      String codecClassName)
    throws IOException {

    CompressionCodecFactory factory = new CompressionCodecFactory(conf);
    CompressionCodec codec = factory.getCodecByClassName(codecClassName);
    if (codec == null) {
      throw new IOException("Not a supported codec: " + codecClassName);
    }

    return new FSImageCompression(codec);
  }

  /**
   * Create a compression instance based on a header read from an input stream.
   * @throws IOException if the specified codec is not available or the
   * underlying IO fails.
   */
  static FSImageCompression readCompressionHeader(
    Configuration conf, DataInput in) throws IOException
  {
    boolean isCompressed = in.readBoolean();

    if (!isCompressed) {
      return createNoopCompression();
    } else {

View on GitHub (pinned to 2add963021)

Solutions

  1. Use a supported compression codec for fsimage (e.g. org.apache.hadoop.io.compress.DefaultCodec).
  2. Ensure the codec class is on the NameNode classpath.

When it happens

Trigger: Reading or writing a compressed fsimage with a codec name that is not supported by FSImageCompression.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/45ec34e191a8d8b2. Report an issue: GitHub.