{"record":{"id":"a6de74f2857bf986","repo":"apache/beam","slug":"unknown-file-format","errorCode":null,"errorMessage":"Unknown File Format: {}","messagePattern":"Unknown File Format: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriter.java","lineNumber":122,"sourceCode":"                .build();\n        break;\n      case PARQUET:\n        Parquet.DataWriteBuilder parquetBuilder =\n            Parquet.writeData(outputFile)\n                .forTable(table)\n                .createWriterFunc(GenericParquetWriter::create)\n                .withPartition(partitionKey)\n                .withKeyMetadata(keyMetadata)\n                .overwrite();\n        if (writeProperties != null && !writeProperties.isEmpty()) {\n          parquetBuilder.setAll(writeProperties);\n        }\n        icebergDataWriter = parquetBuilder.build();\n        break;\n      case ORC:\n        throw new UnsupportedOperationException(\"ORC file format not currently supported.\");\n      default:\n        throw new RuntimeException(\"Unknown File Format: \" + fileFormat);\n    }\n    activeIcebergWriters.inc();\n    LOG.info(\n        \"Opened {} writer for table '{}', partition {}. Writing to path: {}\",\n        fileFormat,\n        table.name(),\n        partitionKey,\n        absoluteFilename);\n  }\n\n  public void write(Record record) {\n\n    icebergDataWriter.write(record);\n  }\n\n  public void close() throws IOException {\n    IOException closeError = null;\n    try {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/RecordWriter.java#L104-L140","documentation":"When RecordWriter's switch over FileFormat matches neither PARQUET/AVRO nor ORC, the default branch throws RuntimeException(\"Unknown File Format: ...\"). This is a defensive internal check — FileFormat should be one of the known Iceberg enum values, so reaching default indicates a corrupted or synthetic format value.","triggerScenarios":"fileFormat is null or an unrecognized value when RecordWriter is constructed — e.g. table.properties write.format.default parsed into a null FileFormat, a future/unknown format enum from a newer Iceberg table property, or a null passed through a custom write path.","commonSituations":"A table property like 'write.format.default' set to an invalid string that resolves to null FileFormat; mixing Iceberg library versions where new formats exist; a bug in calling code passing null into RecordWriter.","solutions":["Log/inspect the table properties and ensure write.format.default is one of parquet, avro, orc (orc still unsupported by Beam, use parquet)","Null-check the FileFormat before constructing RecordWriter and default to FileFormat.PARQUET","Upgrade/align the Iceberg runtime version so format parsing matches the library expectations","Check for null fileFormat coming from TableProperties.WRITE_FORMAT_DEFAULT parsing and set a valid value"],"exampleFix":"// before\nFileFormat format = FileFormat.valueOf(props.get(\"write.format.default\")); // may be null\n// after\nFileFormat format = Optional.ofNullable(props.get(\"write.format.default\"))\n    .map(FileFormat::fromName).orElse(FileFormat.PARQUET);","handlingStrategy":"validation","validationCode":"FileFormat fmt = FileFormat.fromName(\n    table.properties().getOrDefault(TableProperties.WRITE_FORMAT_DEFAULT, TableProperties.WRITE_FORMAT_DEFAULT_DEFAULT));\nif (fmt == null) throw new IllegalArgumentException(\"Unrecognized write.format.default on table \" + table.name());","typeGuard":"null","tryCatchPattern":"try {\n  RecordWriter writer = new RecordWriter(..., fileFormat, ...);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Unknown File Format\")) {\n    LOG.error(\"Falling back to PARQUET writer\");\n    writer = new RecordWriter(..., FileFormat.PARQUET, ...);\n  } else { throw e; }\n}","preventionTips":["Always resolve FileFormat with a null-safe default (PARQUET)","Validate table properties before creating RecordWriter","Keep Iceberg runtime versions aligned to avoid unknown format values"],"tags":["java","iceberg","beam","file-format","configuration","null"],"backgroundTag":"invalid-config-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}