{"record":{"id":"749171e2552e0704","repo":"apache/iceberg","slug":"cannot-write-using-unregistered-internal-data-form","errorCode":null,"errorMessage":"Cannot write using unregistered internal data format: %s","messagePattern":"Cannot write using unregistered internal data format: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/InternalData.java","lineNumber":91,"sourceCode":"      DynMethods.builder(\"register\").impl(classToRegister).buildStaticChecked().invoke();\n    } catch (NoSuchMethodException | NoClassDefFoundError | ExceptionInInitializerError e) {\n      // failing to load an optional format is normal and does not require a stack trace\n      Throwable cause = e.getCause() != null ? e.getCause() : e;\n      LOG.info(\"Cannot register {} for metadata files: {}\", classToRegister, cause.toString());\n    }\n  }\n\n  static {\n    registerSupportedFormats();\n  }\n\n  public static WriteBuilder write(FileFormat format, OutputFile file) {\n    Function<OutputFile, WriteBuilder> writeBuilder = WRITE_BUILDERS.get(format);\n    if (writeBuilder != null) {\n      return writeBuilder.apply(file);\n    }\n\n    throw new UnsupportedOperationException(\n        \"Cannot write using unregistered internal data format: \" + format);\n  }\n\n  public static ReadBuilder read(FileFormat format, InputFile file) {\n    Function<InputFile, ReadBuilder> readBuilder = READ_BUILDERS.get(format);\n    if (readBuilder != null) {\n      return readBuilder.apply(file);\n    }\n\n    throw new UnsupportedOperationException(\n        \"Cannot read using unregistered internal data format: \" + format);\n  }\n\n  public interface WriteBuilder {\n    /** Set the file schema. */\n    WriteBuilder schema(Schema schema);\n\n    /** Set the file schema's root name. */","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/InternalData.java#L73-L109","documentation":"InternalData.write() only supports file formats that have a WriteBuilder registered (e.g., Avro, Parquet, ORC registered statically). Requesting a write with any other FileFormat throws UnsupportedOperationException because no internal writer implementation exists for it.","triggerScenarios":"Calling InternalData.write(FileFormat.X, outputFile) where X is a format not registered in WRITE_BUILDERS — e.g., a hypothetical/unknown format, or a format supported only for reading (metadata/position-delete contexts).","commonSituations":"Passing a user-configured file format string into InternalData for internal metadata files; adding a new FileFormat enum without registering a builder; tests using a custom format.","solutions":["Use a registered format such as FileFormat.AVRO, FileFormat.PARQUET, or FileFormat.ORC for internal data writes","Register a custom WriteBuilder via InternalData's registration mechanism if extending","Check the FileFormat value passed in — it likely comes from misparsed configuration"],"exampleFix":"// before\nInternalData.write(FileFormat.fromString(\"data\"), out)...\n// after\nInternalData.write(FileFormat.AVRO, out)...","handlingStrategy":"validation","validationCode":"if (format != FileFormat.AVRO && format != FileFormat.PARQUET && format != FileFormat.ORC) {\n  throw new IllegalArgumentException(\"Unsupported internal format: \" + format);\n}","typeGuard":null,"tryCatchPattern":"try {\n  InternalData.write(format, file)...;\n} catch (UnsupportedOperationException e) {\n  LOG.error(\"Internal write unsupported for {}\", format, e);\n}","preventionTips":["Only pass AVRO/PARQUET/ORC to InternalData","Derive FileFormat from validated config values","Check InternalData source for the registered formats of your version"],"tags":["java","unsupported-operation","file-format"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}