apache/iceberg · error · UnsupportedOperationException

Cannot read using unregistered internal data format

Error message

Cannot read using unregistered internal data format: %s

What it means

InternalData.read() only supports file formats with a registered ReadBuilder. Requesting a read with an unregistered FileFormat throws UnsupportedOperationException since no internal reader exists for that format.

Solutions

  1. Read with a registered format (AVRO, PARQUET, ORC) matching how the file was written
  2. Register a custom ReadBuilder if supporting a new format
  3. Verify the file's actual format — it may have been written by a non-Iceberg tool

Example fix

// before
InternalData.read(FileFormat.fromString("json"), in)...
// after
InternalData.read(FileFormat.PARQUET, in)...
Defensive patterns

Strategy: validation

Validate before calling

if (format != FileFormat.AVRO && format != FileFormat.PARQUET && format != FileFormat.ORC) {
  throw new IllegalArgumentException("Unsupported internal format: " + format);
}

Try / catch

try {
  InternalData.read(format, file)...;
} catch (UnsupportedOperationException e) {
  LOG.error("Internal read unsupported for {}", format, e);
}

Prevention

When it happens

Trigger: Calling InternalData.read(FileFormat.X, inputFile) where X is not in READ_BUILDERS — e.g., an unknown format, or a format with no read support registered.

Common situations: Reading internal metadata files (manifests, statistics, position deletes) whose format was misconfigured or produced by a non-standard writer; new FileFormat enum value without a registered reader.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/InternalData.java:101

  }

  public static WriteBuilder write(FileFormat format, OutputFile file) {
    Function<OutputFile, WriteBuilder> writeBuilder = WRITE_BUILDERS.get(format);
    if (writeBuilder != null) {
      return writeBuilder.apply(file);
    }

    throw new UnsupportedOperationException(
        "Cannot write using unregistered internal data format: " + format);
  }

  public static ReadBuilder read(FileFormat format, InputFile file) {
    Function<InputFile, ReadBuilder> readBuilder = READ_BUILDERS.get(format);
    if (readBuilder != null) {
      return readBuilder.apply(file);
    }

    throw new UnsupportedOperationException(
        "Cannot read using unregistered internal data format: " + format);
  }

  public interface WriteBuilder {
    /** Set the file schema. */
    WriteBuilder schema(Schema schema);

    /** Set the file schema's root name. */
    WriteBuilder named(String name);

    /**
     * Set a writer configuration property.
     *
     * <p>Write configuration affects writer behavior. To add file metadata properties, use {@link
     * #meta(String, String)}.
     *
     * @param property a writer config property name
     * @param value config value

View on GitHub (pinned to 86d9c8fc54)