pentaho/pentaho-kettle · error · MetaStoreNamespaceExistsException

Namespace ' ' can not be created, it already exists

Error message

Namespace '${namespace}' can not be created, it already exists

What it means

Thrown by PurRepositoryMetaStore.createNamespace() when namespaceExists(namespace) is already true. It is a MetaStoreNamespaceExistsException, preventing the creation of a duplicate namespace folder under the metastore root.

Solutions

  1. Check namespaceExists() before calling createNamespace
  2. Use openNamespace/delete+recreate according to your intent
  3. Catch MetaStoreNamespaceExistsException and treat as success if the namespace is equivalent

Example fix

// before
metaStore.createNamespace( "myNamespace" );
// after
if ( !metaStore.namespaceExists( "myNamespace" ) ) {
  metaStore.createNamespace( "myNamespace" );
}
Defensive patterns

Strategy: validation

Validate before calling

if ( !metaStore.namespaceExists( namespace ) ) {
  metaStore.createNamespace( namespace );
}

Try / catch

try { metaStore.createNamespace( ns ); } catch ( MetaStoreNamespaceExistsException e ) { logBasic( "Namespace already exists: " + ns ); }

Prevention

When it happens

Trigger: Calling createNamespace(ns) for a namespace that already has a folder in /etc/metastore on the server — typical on re-running an initialization routine or concurrent creation by another client.

Common situations: Installer/migration scripts run twice; two PDI clients creating the same namespace concurrently; case-insensitive filesystem collisions.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/a79dcd3c081314b2. Report an issue: GitHub.

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/metastore/PurRepositoryMetaStore.java:94

    }
  }

  @Override
  public String getName() {
    return repository.getRepositoryMeta().getName();
  }

  @Override
  public String getDescription() {
    return repository.getRepositoryMeta().getDescription();
  }

  // The namespaces

  @Override
  public void createNamespace( String namespace ) throws MetaStoreException {
    if ( namespaceExists( namespace ) ) {
      throw new MetaStoreNamespaceExistsException( "Namespace '" + namespace
          + "' can not be created, it already exists" );
    }
    RepositoryFile namespaceFolder = new RepositoryFile.Builder( namespace ).folder( true ).versioned( false ).build();

    pur.createFolder( namespacesFolder.getId(), namespaceFolder, "Created namespace" );
  }

  @Override
  public boolean namespaceExists( String namespace ) throws MetaStoreException {
    return getNamespaceRepositoryFile( namespace ) != null;
  }

  @Override
  public void deleteNamespace( String namespace ) throws MetaStoreException {
    RepositoryFile namespaceFile = getNamespaceRepositoryFile( namespace );
    if ( namespaceFile == null ) {
      return; // already gone.
    }

View on GitHub (pinned to f3058517a1)