apache/iceberg · error · UnsupportedOperationException

setConf is not implemented

Error message

setConf is not implemented

What it means

HadoopConfigurable is a Configurable adapter for Hadoop objects. The default setConf implementation throws UnsupportedOperationException; implementations must override it to accept a Configuration. This guard exists so objects that cannot be reconfigured at runtime fail loudly instead of silently ignoring a configuration.

Source

Thrown at core/src/main/java/org/apache/iceberg/hadoop/HadoopConfigurable.java:53

  /**
   * Take a function that serializes Hadoop configuration into a supplier. An implementation is
   * supposed to pass in its current Hadoop configuration into this function, and the result can be
   * safely serialized for future use.
   *
   * @param confSerializer A function that takes Hadoop configuration and returns a serializable
   *     supplier of it.
   */
  void serializeConfWith(
      Function<Configuration, SerializableSupplier<Configuration>> confSerializer);

  /**
   * Set the configuration to be used by this object.
   *
   * @param conf configuration to be used
   */
  @Override
  default void setConf(Configuration conf) {
    throw new UnsupportedOperationException("setConf is not implemented");
  }

  /**
   * Return the configuration used by this object.
   *
   * @return Configuration
   */
  default Configuration getConf() {
    throw new UnsupportedOperationException("getConf is not implemented");
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Override setConf in your HadoopConfigurable implementation to store and apply the Configuration.
  2. Construct the object with the Configuration directly (constructor injection) instead of calling setConf.
  3. If you control the caller, check whether the class actually implements setConf before calling it.

Example fix

// before
class MyFileIO extends HadoopConfigurable { /* no setConf override */ }
// after
class MyFileIO extends HadoopConfigurable {
  private Configuration conf;
  @Override
  public void setConf(Configuration conf) { this.conf = conf; }
}
Defensive patterns

Strategy: type-guard

Validate before calling

Configuration conf = new Configuration();
// construct via ctor/factory that injects conf instead of calling setConf on unimplemented types

Type guard

if (obj.getClass().getDeclaredMethods() stream anyMatch m -> m.getName().equals("setConf") && !m.isSynthetic()) { obj.setConf(conf); }

Try / catch

try {
  obj.setConf(conf);
} catch (UnsupportedOperationException e) {
  LOG.error("{} does not support setConf; pass conf via constructor", obj.getClass().getName());
}

Prevention

When it happens

Trigger: Calling setConf(conf) on a HadoopConfigurable object whose class did not override setConf — typically when framework or serialization code injects a Configuration into a HadoopFileIO/refreshing object that only implemented the constructor-based configuration path.

Common situations: Reflection-based instantiation of catalog or FileIO classes where the container calls Configurable.setConf; custom HadoopFileIO subclasses extending HadoopConfigurable without overriding setConf; code paths that re-inject configuration after deserialization.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/b278b679fc77eb65. Report an issue: GitHub.