{"record":{"id":"7ac540cb40994231","repo":"apache/iceberg","slug":"namespace-s-s-has-already-existed","errorCode":null,"errorMessage":"namespace %s(%s) has already existed","messagePattern":"namespace (.+?)\\((.+?)\\) has already existed","errorType":"exception","errorClass":"AlreadyExistsException","httpStatus":409,"severity":"error","filePath":"dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java","lineNumber":269,"sourceCode":"    }\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);\n  }\n\n  @Override\n  public void createNamespace(Namespace namespace, Map<String, String> properties) {\n    EcsURI namespaceObject = namespaceURI(namespace);\n    if (!putNewProperties(namespaceObject, properties)) {\n      throw new AlreadyExistsException(\n          \"namespace %s(%s) has already existed\", namespace, namespaceObject);\n    }\n  }\n\n  private EcsURI namespaceURI(Namespace namespace) {\n    return new EcsURI(String.format(\"%s%s\", namespacePrefix(namespace), NAMESPACE_OBJECT_SUFFIX));\n  }\n\n  @Override\n  public List<Namespace> listNamespaces(Namespace namespace) throws NoSuchNamespaceException {\n    if (!namespace.isEmpty() && !namespaceExists(namespace)) {\n      throw new NoSuchNamespaceException(\"Namespace %s does not exist\", namespace);\n    }\n\n    String marker = null;\n    List<Namespace> results = Lists.newArrayList();\n    // Add the end slash when delimiter listing\n    EcsURI prefix = new EcsURI(String.format(\"%s/\", namespacePrefix(namespace)));","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java#L251-L287","documentation":"EcsCatalog.createNamespace throws AlreadyExistsException when putNewProperties cannot create the namespace marker object because an object already exists at the namespace URI. Namespaces in ECS are represented by a marker object, so its existence means the namespace was already created.","triggerScenarios":"Calling catalog.createNamespace(namespace, properties) when the namespace marker object already exists — either created previously by this catalog or an object occupying the same key (e.g. a leftover marker after an incomplete drop).","commonSituations":"Idempotent setup scripts that call createNamespace on every run without checking existence; leftover NAMESPACE_OBJECT_SUFFIX marker from a failed drop; two processes creating the same namespace concurrently.","solutions":["Check catalog.namespaceExists(namespace) before creating and skip if present.","Catch AlreadyExistsException and treat it as success in idempotent provisioning code.","If the marker is a stale leftover, delete the leftover object (e.g. via dropNamespace cleanup) and retry."],"exampleFix":"// before\ncatalog.createNamespace(Namespace.of(\"sales\"), props);\n// after\nif (!catalog.namespaceExists(Namespace.of(\"sales\"))) {\n  catalog.createNamespace(Namespace.of(\"sales\"), props);\n}","handlingStrategy":"validation","validationCode":"Namespace ns = Namespace.of(\"sales\");\nif (!catalog.namespaceExists(ns)) { catalog.createNamespace(ns); }","typeGuard":null,"tryCatchPattern":"try {\n  catalog.createNamespace(ns, props);\n} catch (AlreadyExistsException e) {\n  LOG.info(\"Namespace {} already exists, continuing\", ns);\n}","preventionTips":["Make provisioning scripts idempotent with namespaceExists checks","Clean up stale namespace marker objects after failed drops","Coordinate namespace creation across concurrent jobs"],"tags":["dell","ecs","catalog","namespace","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"}