apache/iceberg · error · IllegalArgumentException

Unknown file content:

Error message

Unknown file content: 

What it means

ORCFormatModel.build() dispatches on the configured FileContent (DATA, POSITION_DELETES, EQUALITY_DELETES, etc.). If the content field holds an unrecognized value (e.g. a newer FileContent enum constant or a null/uninitialized content), the default branch throws IllegalArgumentException with this message.

Solutions

  1. Ensure the write builder sets FileContent correctly (DATA for data files, POSITION_DELETES for position deletes)
  2. Upgrade Iceberg if writing a newer file content type not supported by the installed ORC writer
  3. Check that custom builder code doesn't pass null or an out-of-range content value

Example fix

// before
builder.content(null).build(); // IllegalArgumentException
// after
builder.content(FileContent.DATA).build();
Defensive patterns

Strategy: validation

Validate before calling

FileContent content = builderContent();
if (content != FileContent.DATA && content != FileContent.POSITION_DELETES && content != FileContent.EQUALITY_DELETES) {
  throw new IllegalArgumentException("Unsupported file content for ORC: " + content);
}

Type guard

boolean orcContentSupported(FileContent c) {
  return c == FileContent.DATA || c == FileContent.POSITION_DELETES || c == FileContent.EQUALITY_DELETES;
}

Try / catch

try {
  appender = formatModel.build();
} catch (IllegalArgumentException e) {
  if (e.getMessage().startsWith("Unknown file content")) {
    throw new IllegalStateException("Set FileContent explicitly before building ORC appender", e);
  } throw e;
}

Prevention

When it happens

Trigger: Building an ORC appender whose FileContent is not one of the handled cases — typically an uninitialized/incorrectly set builder or a new content type added to Iceberg but not yet supported by the ORC writer.

Common situations: Custom writer tooling that sets FileContent incorrectly; forward-compatibility gap where a table uses a newer spec feature (e.g. new delete type) with an older Iceberg ORC writer.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at orc/src/main/java/org/apache/iceberg/orc/ORCFormatModel.java:202

          Preconditions.checkState(
              schema == null,
              "Invalid schema: %s. Position deletes with schema are not supported by the API.",
              schema);
          Preconditions.checkState(
              engineSchema == null,
              "Invalid engineSchema: %s. Position deletes with schema are not supported by the API.",
              engineSchema);

          internal.createContextFunc(ORC.WriteBuilder.Context::deleteContext);
          internal.createWriterFunc(
              (icebergSchema, typeDescription) ->
                  GenericOrcWriters.positionDelete(
                      GenericOrcWriter.buildWriter(icebergSchema, typeDescription),
                      Function.identity()));
          internal.schema(DeleteSchemaUtil.pathPosSchema());
          break;
        default:
          throw new IllegalArgumentException("Unknown file content: " + content);
      }

      return internal.build();
    }
  }

  private static class ReadBuilderWrapper<D, S, R> implements ReadBuilder<D, S> {
    private final ORC.ReadBuilder internal;
    private final ReaderFunction<R, S, TypeDescription> readerFunction;
    private final boolean isBatchReader;
    private S engineSchema;
    private boolean reuseContainers = false;
    private Schema icebergSchema;
    private Map<Integer, ?> idToConstant = ImmutableMap.of();

    private ReadBuilderWrapper(
        InputFile inputFile,
        ReaderFunction<R, S, TypeDescription> readerFunction,

View on GitHub (pinned to 86d9c8fc54)