apache/iceberg · error · UnsupportedOperationException

getConf is not implemented

Error message

getConf is not implemented

What it means

HadoopConfigurable's default getConf throws UnsupportedOperationException. Any implementation that did not override getConf (or never had a Configuration set) fails when a caller tries to read the configuration, e.g. HadoopFileIO.deleteFile internally uses getConf() to resolve the FileSystem.

Source

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

      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 getConf in your implementation to return the stored Configuration.
  2. Ensure setConf is invoked before any operation that calls getConf.
  3. Use HadoopFileIO directly (which implements both) rather than subclassing HadoopConfigurable minimally.

Example fix

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

Strategy: type-guard

Validate before calling

// ensure setConf was called at least once before relying on getConf()/file operations

Type guard

if (obj instanceof HadoopFileIO) { /* getConf is implemented */ } else { /* avoid getConf */ }

Try / catch

try {
  Configuration conf = obj.getConf();
} catch (UnsupportedOperationException e) {
  LOG.error("{} does not implement getConf", obj.getClass().getName());
}

Prevention

When it happens

Trigger: Calling getConf() on a HadoopConfigurable subclass that does not override it, or calling operations like deleteFile on a HadoopFileIO that was deserialized/instantiated without a Configuration being set.

Common situations: Custom FileIO implementations extending HadoopConfigurable without implementing both accessors; objects created reflectively without going through the setConf lifecycle; using a FileIO after Kryo/Java deserialization into an environment where conf injection was skipped.

Related errors


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