{"record":{"id":"1800c4265e5a0d16","repo":"apache/iceberg","slug":"cannot-rename-s-to-s-because-namespace-s-does-n-1800c4","errorCode":null,"errorMessage":"Cannot rename %s to %s because namespace %s does not exist","messagePattern":"Cannot rename (.+?) to (.+?) because namespace (.+?) does not exist","errorType":"exception","errorClass":"NoSuchNamespaceException","httpStatus":404,"severity":"error","filePath":"dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java","lineNumber":239,"sourceCode":"    client.deleteObject(tableObjectURI.bucket(), tableObjectURI.name());\n    return true;\n  }\n\n  private EcsURI tableURI(TableIdentifier id) {\n    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(","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java#L221-L257","documentation":"EcsCatalog.renameTable validates that the destination namespace exists before renaming and throws NoSuchNamespaceException when it does not. ECS stores tables as objects under namespace prefixes, so a rename to a non-existent namespace prefix would leave the table unreachable.","triggerScenarios":"Calling catalog.renameTable(from, to) where to.namespace() has no namespace marker object in ECS — e.g. renaming into a namespace that was never created or was dropped.","commonSituations":"Renaming tables during a reorganization into new namespaces without creating them first; typos in the target namespace; concurrent drop of the destination namespace.","solutions":["Call catalog.createNamespace(to.namespace()) before renameTable.","Verify the destination namespace with catalog.namespaceExists(to.namespace()) and catch NoSuchNamespaceException otherwise.","Fix the target namespace identifier if it was a typo."],"exampleFix":"// before\ncatalog.renameTable(from, TableIdentifier.of(Namespace.of(\"archived\"), \"t\"));\n// after\nNamespace ns = Namespace.of(\"archived\");\nif (!catalog.namespaceExists(ns)) { catalog.createNamespace(ns); }\ncatalog.renameTable(from, TableIdentifier.of(ns, \"t\"));","handlingStrategy":"validation","validationCode":"Namespace destNs = to.namespace();\nif (!catalog.namespaceExists(destNs)) { catalog.createNamespace(destNs); }","typeGuard":null,"tryCatchPattern":"try {\n  catalog.renameTable(from, to);\n} catch (NoSuchNamespaceException e) {\n  catalog.createNamespace(to.namespace());\n  catalog.renameTable(from, to);\n}","preventionTips":["Create all target namespaces before table reorganizations","Validate namespace spelling in scripts","Serialize reorganization jobs that share namespaces"],"tags":["dell","ecs","catalog","rename","namespace"],"backgroundTag":"resource-not-found","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"}