{"record":{"id":"90371c73c43d7e5e","repo":"apache/iceberg","slug":"cannot-rename-s-because-destination-table-s-exis","errorCode":null,"errorMessage":"Cannot rename %s because destination table %s exists","messagePattern":"Cannot rename (.+?) because destination table (.+?) exists","errorType":"exception","errorClass":"AlreadyExistsException","httpStatus":409,"severity":"error","filePath":"dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java","lineNumber":244,"sourceCode":"    return new EcsURI(\n        String.format(\"%s/%s%s\", namespacePrefix(id.namespace()), id.name(), TABLE_OBJECT_SUFFIX));\n  }\n\n  /**\n   * Table rename will only move table object, the data objects will still be in-place.\n   *\n   * @param from identifier of the table to rename\n   * @param to new table name\n   */\n  @Override\n  public void renameTable(TableIdentifier from, TableIdentifier to) {\n    if (!namespaceExists(to.namespace())) {\n      throw new NoSuchNamespaceException(\n          \"Cannot rename %s to %s because namespace %s does not exist\", from, to, to.namespace());\n    }\n\n    if (tableExists(to)) {\n      throw new AlreadyExistsException(\n          \"Cannot rename %s because destination table %s exists\", from, to);\n    }\n\n    EcsURI fromURI = tableURI(from);\n    if (!objectMetadata(fromURI).isPresent()) {\n      throw new NoSuchTableException(\"Cannot rename table because table %s does not exist\", from);\n    }\n\n    Properties properties = loadProperties(fromURI);\n    EcsURI toURI = tableURI(to);\n\n    if (!putNewProperties(toURI, properties.content())) {\n      throw new AlreadyExistsException(\n          \"Cannot rename %s because destination table %s exists\", from, to);\n    }\n\n    client.deleteObject(fromURI.bucket(), fromURI.name());\n    LOG.info(\"Rename table {} to {}\", from, to);","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java#L226-L262","documentation":"EcsCatalog.renameTable throws AlreadyExistsException when the destination table identifier already exists as an object in ECS. Rename refuses to overwrite an existing table silently; drop or rename the destination away first.","triggerScenarios":"Calling catalog.renameTable(from, to) where tableExists(to) is true — a properties object exists at the destination table URI.","commonSituations":"Retrying a partially completed rename that already copied properties to the destination; renaming over an existing table by accident; concurrent jobs renaming to the same target.","solutions":["Drop or rename the existing destination table before retrying.","Use a different target table name.","Check catalog.tableExists(to) before renaming and handle the conflict explicitly."],"exampleFix":"// before\ncatalog.renameTable(from, to);\n// after\nif (catalog.tableExists(to)) {\n  catalog.dropTable(to);\n}\ncatalog.renameTable(from, to);","handlingStrategy":"validation","validationCode":"if (catalog.tableExists(to)) { throw new IllegalStateException(\"Destination exists: \" + to); }","typeGuard":null,"tryCatchPattern":"try {\n  catalog.renameTable(from, to);\n} catch (AlreadyExistsException e) {\n  LOG.error(\"Destination {} already exists\", to, e);\n}","preventionTips":["Check tableExists on the destination before renaming","Generate unique destination names in automated flows","Avoid retrying completed renames blindly"],"tags":["dell","ecs","catalog","rename","conflict"],"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-14T16:17:12.679Z"}