apache/iceberg · error · UncheckedIOException

Failed to create new position delete writer

Error message

Failed to create new position delete writer

What it means

RegistryBasedFileWriterFactory.newPositionDeleteWriter builds a PositionDeleteWriter via the writer registry; an IOException while creating/opening the position delete output file is wrapped in UncheckedIOException with this message.

Source

Thrown at data/src/main/java/org/apache/iceberg/data/RegistryBasedFileWriterFactory.java:178

      EncryptedOutputFile file, PartitionSpec spec, StructLike partition) {
    EncryptionKeyMetadata keyMetadata = file.keyMetadata();
    Map<String, String> properties = table != null ? table.properties() : ImmutableMap.of();
    MetricsConfig metricsConfig = MetricsConfig.forPositionDelete();

    try {
      FileWriterBuilder<PositionDeleteWriter<T>, ?> builder =
          FormatModelRegistry.positionDeleteWriteBuilder(deleteFileFormat, file);
      return builder
          .setAll(properties)
          .setAll(writerProperties)
          .metricsConfig(metricsConfig)
          .spec(spec)
          .partition(partition)
          .keyMetadata(keyMetadata)
          .overwrite()
          .build();
    } catch (IOException e) {
      throw new UncheckedIOException("Failed to create new position delete writer", e);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Inspect the chained IOException cause for the underlying open error.
  2. Register/verify a PositionDeleteWriter factory for the configured file format in the registry.
  3. Validate output location permissions and FileIO credentials.
  4. Confirm encryption configuration if output files are encrypted.

Example fix

// before: missing writer registration causes wrapped IO failure
// after
registry.addFactory(Parquet.PositionDeleteWriter.class, new ParquetPositionDeleteWriterFactory());
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure a position delete writer factory exists for the format
if (registry.factory(Parquet.PositionDeleteWriter.class) == null) {
  throw new IllegalStateException("No position delete writer registered");
}

Try / catch

try {
  PositionDeleteWriter<T> w = factory.newPositionDeleteWriter(file, spec, partition);
} catch (UncheckedIOException e) {
  throw new RuntimeException("Position delete writer open failed: " + e.getCause().getMessage(), e.getCause());
}

Prevention

When it happens

Trigger: Calling newPositionDeleteWriter(file, spec, partition) when opening the EncryptedOutputFile fails or the registry lacks a position-delete writer for the format.

Common situations: Storage access failures (expired credentials, missing directory/bucket); custom registries missing position-delete mappings; encrypted output requiring unavailable KMS keys.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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