{"record":{"id":"a5864fd8ff957763","repo":"apache/iceberg","slug":"table-is-existing-when-create-table-s","errorCode":null,"errorMessage":"Table is existing when create table %s","messagePattern":"Table is existing when create table (.+?)","errorType":"exception","errorClass":"CommitFailedException","httpStatus":null,"severity":"error","filePath":"dell/src/main/java/org/apache/iceberg/dell/ecs/EcsTableOperations.java","lineNumber":95,"sourceCode":"    } else {\n      EcsCatalog.Properties metadata = catalog.loadProperties(tableObject);\n      this.eTag = metadata.eTag();\n      metadataLocation = metadata.content().get(ICEBERG_METADATA_LOCATION);\n      Preconditions.checkNotNull(\n          metadataLocation, \"Can't find location from table metadata %s\", tableObject);\n    }\n\n    refreshFromMetadataLocation(metadataLocation);\n  }\n\n  @Override\n  protected void doCommit(TableMetadata base, TableMetadata metadata) {\n    boolean newTable = base == null;\n    String newMetadataLocation = writeNewMetadataIfRequired(newTable, metadata);\n    if (base == null) {\n      // create a new table, the metadataKey should be absent\n      if (!catalog.putNewProperties(tableObject, buildProperties(newMetadataLocation))) {\n        throw new CommitFailedException(\"Table is existing when create table %s\", tableName());\n      }\n    } else {\n      String cachedETag = eTag;\n      Preconditions.checkNotNull(cachedETag, \"E-Tag must be not null when update table\");\n      // replace to a new version, the E-Tag should be present and matched\n      boolean result =\n          catalog.updatePropertiesObject(\n              tableObject, cachedETag, buildProperties(newMetadataLocation));\n      if (!result) {\n        throw new CommitFailedException(\n            \"Replace failed, E-Tag %s mismatch for table %s\", cachedETag, tableName());\n      }\n    }\n  }\n\n  /** Build properties for table */\n  private Map<String, String> buildProperties(String metadataLocation) {\n    return ImmutableMap.of(ICEBERG_METADATA_LOCATION, metadataLocation);","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsTableOperations.java#L77-L113","documentation":"CommitFailedException thrown by EcsTableOperations.doCommit when creating a new table (base == null) but a properties object already exists at the table's key, so the atomic putNewProperties failed. The table already exists.","triggerScenarios":"Calling createTable for a name that already exists in the ECS catalog; the conditional put (expecting the metadata key absent) failed.","commonSituations":"Concurrent createTable calls with the same identifier, re-running a create job without dropping, leftover properties object from a failed prior creation.","solutions":["Use catalog.tableExists to check before creating, or load and reuse the existing table","Drop the existing table first if recreation is intended","Catch CommitFailedException and treat as AlreadyExists"],"exampleFix":"// before\ncatalog.createTable(tableId, schema);\n// after\nif (!catalog.tableExists(tableId)) {\n  catalog.createTable(tableId, schema);\n}","handlingStrategy":"try-catch","validationCode":"if (catalog.tableExists(tableId)) { table = catalog.loadTable(tableId); } else { catalog.createTable(tableId, schema); }","typeGuard":null,"tryCatchPattern":"try { catalog.createTable(tableId, schema); } catch (CommitFailedException e) { table = catalog.loadTable(tableId); }","preventionTips":["Check tableExists before createTable","Use unique table identifiers in concurrent jobs","Clean up leftover properties objects from failed creations"],"tags":["table","ecs","concurrency","commit"],"backgroundTag":"file-already-exists","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"}