{"record":{"id":"7b5efc8454ffe771","repo":"apache/iceberg","slug":"registering-tables-is-not-supported","errorCode":null,"errorMessage":"Registering tables is not supported","messagePattern":"Registering tables is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/catalog/Catalog.java","lineNumber":363,"sourceCode":"   * <p>If the table is already loaded or cached, drop cached data. If the table does not exist or\n   * is not cached, do nothing.\n   *\n   * @param identifier a table identifier\n   */\n  default void invalidateTable(TableIdentifier identifier) {}\n\n  /**\n   * Register a table with the catalog if it does not exist.\n   *\n   * <p>For overwrite support, see {@link #registerTable(TableIdentifier, String, boolean)}.\n   *\n   * @param identifier a table identifier\n   * @param metadataFileLocation the location of a metadata file\n   * @return a Table instance\n   * @throws AlreadyExistsException if the table already exists in the catalog.\n   */\n  default Table registerTable(TableIdentifier identifier, String metadataFileLocation) {\n    throw new UnsupportedOperationException(\"Registering tables is not supported\");\n  }\n\n  /**\n   * Register a table with the catalog.\n   *\n   * @param identifier a table identifier\n   * @param metadataFileLocation the location of a metadata file\n   * @param overwrite whether to overwrite an existing table registration\n   * @return a Table instance\n   * @throws AlreadyExistsException if {@code overwrite} is false and the table already exists in\n   *     the catalog\n   */\n  default Table registerTable(\n      TableIdentifier identifier, String metadataFileLocation, boolean overwrite) {\n    if (!overwrite) {\n      return registerTable(identifier, metadataFileLocation);\n    }\n","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/catalog/Catalog.java#L345-L381","documentation":"Catalog.registerTable(TableIdentifier, String) is a default interface method that throws UnsupportedOperationException. Catalogs are not required to support registering an existing table from a metadata file location; those that do must override this method. Hitting this error means the concrete Catalog implementation in use does not implement table registration.","triggerScenarios":"Calling catalog.registerTable(identifier, metadataFileLocation) on a Catalog implementation (e.g. HadoopCatalog or custom in-memory/user catalog) that has not overridden the default method.","commonSituations":"Migrating tables between catalogs by pointing a new catalog at existing metadata.json files; disaster recovery re-registration scripts; using a generic Catalog reference where the concrete catalog lacks register support.","solutions":["Switch to a catalog implementation that supports registration (e.g. HiveCatalog, JDBC, Nessie, REST)","Drop the registerTable call and recreate the table via createTable with the same data instead","Override registerTable in the custom Catalog implementation","Check the concrete catalog class and its docs for registerTable support before calling"],"exampleFix":"// before\ncatalog.registerTable(TableIdentifier.of(\"db\", \"t\"), \"s3://bucket/db/t/metadata/00001-xyz.metadata.json\");\n// after\n// Use a catalog that implements registration, e.g.:\nCatalog catalog = CatalogUtil.loadCatalog(\"org.apache.iceberg.jdbc.JdbcCatalog\", ...);\ncatalog.registerTable(TableIdentifier.of(\"db\", \"t\"), metadataFileLocation);","handlingStrategy":"try-catch","validationCode":"// Check catalog capability before calling (reflectively or via docs)\nboolean supportsRegister = !(catalog.getClass().getSimpleName().equals(\"HadoopCatalog\"));","typeGuard":null,"tryCatchPattern":"try {\n  return catalog.registerTable(ident, metadataFileLocation);\n} catch (UnsupportedOperationException e) {\n  throw new IllegalStateException(\"Catalog \" + catalog.getClass().getName() + \" cannot register tables\", e);\n}","preventionTips":["Verify the target catalog supports registerTable before building migration scripts","Use catalog adapters (CatalogUtil) that route to capable implementations","Prefer full-featured catalogs (Hive/JDBC/REST) for registration workflows","Add an integration test for table registration against the production catalog type"],"tags":["java","unsupported-operation","catalog","table-registration"],"backgroundTag":"unsupported-operation","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"}