{"record":{"id":"39d9660f6cff7b84","repo":"apache/iceberg","slug":"failed-to-create-new-position-delete-writer","errorCode":null,"errorMessage":"Failed to create new position delete writer","messagePattern":"Failed to create new position delete writer","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"data/src/main/java/org/apache/iceberg/data/RegistryBasedFileWriterFactory.java","lineNumber":178,"sourceCode":"      EncryptedOutputFile file, PartitionSpec spec, StructLike partition) {\n    EncryptionKeyMetadata keyMetadata = file.keyMetadata();\n    Map<String, String> properties = table != null ? table.properties() : ImmutableMap.of();\n    MetricsConfig metricsConfig = MetricsConfig.forPositionDelete();\n\n    try {\n      FileWriterBuilder<PositionDeleteWriter<T>, ?> builder =\n          FormatModelRegistry.positionDeleteWriteBuilder(deleteFileFormat, file);\n      return builder\n          .setAll(properties)\n          .setAll(writerProperties)\n          .metricsConfig(metricsConfig)\n          .spec(spec)\n          .partition(partition)\n          .keyMetadata(keyMetadata)\n          .overwrite()\n          .build();\n    } catch (IOException e) {\n      throw new UncheckedIOException(\"Failed to create new position delete writer\", e);\n    }\n  }\n}\n","sourceCodeStart":160,"sourceCodeEnd":182,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/data/src/main/java/org/apache/iceberg/data/RegistryBasedFileWriterFactory.java#L160-L182","documentation":"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.","triggerScenarios":"Calling newPositionDeleteWriter(file, spec, partition) when opening the EncryptedOutputFile fails or the registry lacks a position-delete writer for the format.","commonSituations":"Storage access failures (expired credentials, missing directory/bucket); custom registries missing position-delete mappings; encrypted output requiring unavailable KMS keys.","solutions":["Inspect the chained IOException cause for the underlying open error.","Register/verify a PositionDeleteWriter factory for the configured file format in the registry.","Validate output location permissions and FileIO credentials.","Confirm encryption configuration if output files are encrypted."],"exampleFix":"// before: missing writer registration causes wrapped IO failure\n// after\nregistry.addFactory(Parquet.PositionDeleteWriter.class, new ParquetPositionDeleteWriterFactory());","handlingStrategy":"try-catch","validationCode":"// ensure a position delete writer factory exists for the format\nif (registry.factory(Parquet.PositionDeleteWriter.class) == null) {\n  throw new IllegalStateException(\"No position delete writer registered\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  PositionDeleteWriter<T> w = factory.newPositionDeleteWriter(file, spec, partition);\n} catch (UncheckedIOException e) {\n  throw new RuntimeException(\"Position delete writer open failed: \" + e.getCause().getMessage(), e.getCause());\n}","preventionTips":["Register position-delete writer factories for all formats in use.","Verify storage credentials and bucket/path existence before write jobs.","Pre-test encrypted output paths if encryption is enabled."],"tags":["io","writer","position-deletes","unchecked-ioexception","file-write"],"backgroundTag":"file-write-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}