{"record":{"id":"b811fa2e36ec780c","repo":"apache/iceberg","slug":"cannot-create-the-table-with-connector-iceberg-b811fa","errorCode":null,"errorMessage":"Cannot create the table with 'connector'='iceberg' table property in an iceberg catalog, Please create table with 'connector'='iceberg' property in a non-iceberg catalog or create table without 'connector'='iceberg' related properties in an iceberg table.","messagePattern":"Cannot create the table with 'connector'='iceberg' table property in an iceberg catalog, Please create table with 'connector'='iceberg' property in a non-iceberg catalog or create table without 'connector'='iceberg' related properties in an iceberg table\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java","lineNumber":420,"sourceCode":"          toIdentifier(new ObjectPath(tablePath.getDatabaseName(), newTableName)));\n    } catch (org.apache.iceberg.exceptions.NoSuchTableException e) {\n      if (!ignoreIfNotExists) {\n        throw new TableNotExistException(getName(), tablePath, e);\n      }\n    } catch (AlreadyExistsException e) {\n      throw new TableAlreadyExistException(getName(), tablePath, e);\n    }\n  }\n\n  @Override\n  public void createTable(ObjectPath tablePath, CatalogBaseTable table, boolean ignoreIfExists)\n      throws CatalogException, TableAlreadyExistException {\n    // Creating Iceberg table using connector is allowed only when table is created using LIKE\n    if (Objects.equals(\n            table.getOptions().get(FlinkCreateTableOptions.CONNECTOR_PROPS_KEY),\n            FlinkDynamicTableFactory.FACTORY_IDENTIFIER)\n        && table.getOptions().get(FlinkCreateTableOptions.SRC_CATALOG_PROPS_KEY) == null) {\n      throw new IllegalArgumentException(\n          \"Cannot create the table with 'connector'='iceberg' table property in \"\n              + \"an iceberg catalog, Please create table with 'connector'='iceberg' property in a non-iceberg catalog or \"\n              + \"create table without 'connector'='iceberg' related properties in an iceberg table.\");\n    }\n\n    Preconditions.checkArgument(\n        table instanceof ResolvedCatalogTable,\n        \"Expected a ResolvedCatalogTable but got: %s. \"\n            + \"Iceberg Flink catalog only supports resolved catalog tables \"\n            + \"(Materialized tables and other table kinds are not supported).\",\n        table == null ? \"null\" : table.getClass().getName());\n    createIcebergTable(tablePath, (ResolvedCatalogTable) table, ignoreIfExists);\n  }\n\n  void createIcebergTable(ObjectPath tablePath, ResolvedCatalogTable table, boolean ignoreIfExists)\n      throws CatalogException, TableAlreadyExistException {\n    validateFlinkTable(table);\n","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L402-L438","documentation":"In an Iceberg catalog, creating a table that explicitly sets 'connector'='iceberg' is redundant and only valid when the table is created via LIKE from a source catalog table (indicated by the src-catalog property being set). The library throws IllegalArgumentException to stop users from persisting Flink connector options into Iceberg table metadata.","triggerScenarios":"CREATE TABLE ... WITH ('connector'='iceberg') executed against an iceberg catalog where the option map contains CONNECTOR_PROPS_KEY='iceberg' and SRC_CATALOG_PROPS_KEY is null (not a LIKE-created table).","commonSituations":"Copy-pasting DDL written for a generic Flink catalog into an iceberg catalog; migration scripts that template connector options into every CREATE TABLE.","solutions":["Remove the 'connector'='iceberg' option from the WITH clause when the catalog is already an iceberg catalog","If bridging from a source catalog, use CREATE TABLE LIKE so SRC_CATALOG_PROPS_KEY is set","Strip connector-related options from generated DDL when targeting iceberg catalogs"],"exampleFix":"// before\nCREATE TABLE t (id INT) WITH ('connector'='iceberg');\n// after\nCREATE TABLE t (id INT);","handlingStrategy":"validation","validationCode":"if (\"iceberg\".equals(options.get(\"connector\")) && icebergCatalogUsed) {\n  throw new IllegalArgumentException(\"Drop 'connector'='iceberg' when using an iceberg catalog\");\n}","typeGuard":"null","tryCatchPattern":"try { catalog.createTable(path, table, ignoreIfExists); } catch (IllegalArgumentException e) { /* strip connector options and retry */ }","preventionTips":["Omit connector-related WITH options in iceberg catalogs","Use CREATE TABLE LIKE when bridging from a source catalog","Validate generated DDL templates per catalog type"],"tags":["flink","iceberg-catalog","connector","ddl"],"backgroundTag":"mutually-exclusive-options","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"}