apache/hadoop · error · IOException

Could not find a serializer for the Value class: '{}'. Pleas

Error message

Could not find a serializer for the Value class: '{}'. Please ensure that the configuration 'io.serializations' is properly configured, if you're usingcustom serialization.

What it means

Identical guard to the key-serializer check, applied to the value class: the Writer constructor obtains an (uncompressed) value serializer from SerializationFactory, and if io.serializations contains no Serialization accepting valClass, it throws this IOException naming the value class and the io.serializations key. Key and value classes are checked independently, so a registered key serializer does not help the value.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java:1321

      this.codec = compCodec;
      this.metadata = meta;
      this.syncInterval = syncIntervalVal;
      SerializationFactory serializationFactory =
          new SerializationFactory(config);
      this.keySerializer = serializationFactory.getSerializer(keyClass);
      if (this.keySerializer == null) {
        throw new IOException(
            "Could not find a serializer for the Key class: '"
                + keyClass.getCanonicalName() + "'. "
                + "Please ensure that the configuration '" +
                CommonConfigurationKeys.IO_SERIALIZATIONS_KEY + "' is "
                + "properly configured, if you're using"
                + "custom serialization.");
      }
      this.keySerializer.open(buffer);
      this.uncompressedValSerializer = serializationFactory.getSerializer(valClass);
      if (this.uncompressedValSerializer == null) {
        throw new IOException(
            "Could not find a serializer for the Value class: '"
                + valClass.getCanonicalName() + "'. "
                + "Please ensure that the configuration '" +
                CommonConfigurationKeys.IO_SERIALIZATIONS_KEY + "' is "
                + "properly configured, if you're using"
                + "custom serialization.");
      }
      this.uncompressedValSerializer.open(buffer);
      if (this.codec != null) {
        ReflectionUtils.setConf(this.codec, this.conf);
        this.compressor = CodecPool.getCompressor(this.codec);
        this.deflateFilter = this.codec.createOutputStream(buffer, compressor);
        this.deflateOut = 
          new DataOutputStream(new BufferedOutputStream(deflateFilter));
        this.compressedValSerializer = serializationFactory.getSerializer(valClass);
        if (this.compressedValSerializer == null) {
          throw new IOException(
              "Could not find a serializer for the Value class: '"

View on GitHub (pinned to 2add963021)

Solutions

  1. Register a Serialization that accepts the value class in io.serializations on the exact Configuration passed to createWriter
  2. Or implement Writable for the value class
  3. Verify both lookups up front: SerializationFactory sf = new SerializationFactory(conf); sf.getSerializer(valClass) must be non-null (and likewise for the key)
  4. For POJOs, add org.apache.hadoop.io.serializer.JavaSerialization to io.serializations

Example fix

// before
Writer w = SequenceFile.createWriter(conf, Writer.file(p),
    Writer.keyClass(Text.class), Writer.valueClass(MyValue.class), ...); // IOException for MyValue

// after
conf.set("io.serializations",
    "org.apache.hadoop.io.serializer.WritableSerialization,com.example.ser.MySerialization");
Writer w = SequenceFile.createWriter(conf, Writer.file(p),
    Writer.keyClass(Text.class), Writer.valueClass(MyValue.class), ...);
Defensive patterns

Strategy: validation

Validate before calling

SerializationFactory sf = new SerializationFactory(conf);
if (sf.getSerializer(valClass) == null) {
  throw new IOException("No Serialization for value class " + valClass
      + "; add it to io.serializations");
}

Try / catch

try {
  w = SequenceFile.createWriter(conf, opts);
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("serializer for the Value class")) {
    // value side of io.serializations is missing an entry; fix conf and retry once
  } else { throw e; }
}

Prevention

When it happens

Trigger: Writer.valueClass(MyValue.class) with MyValue not Writable and not covered by a registered Serialization; custom value serialization present in the jar but omitted from the io.serializations list; asymmetric configs where keys are Writable but values are POJOs.

Common situations: Wrapping domain objects as values without making them Writable; classpath issues hiding the custom Serialization implementation; config drift between the writing job and a shared template core-site.xml.

Related errors


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