pentaho/pentaho-kettle · warning · MetaStoreNamespaceExistsException
Namespace with name ''+namespace+'' already exists
Error message
Namespace with name ''+namespace+'' already exists
What it means
createNamespace() first looks up the namespace by name; if a row already exists it throws MetaStoreNamespaceExistsException('Namespace with name X already exists'). This is a deliberate guard so namespaces remain unique in R_NAMESPACE.
Solutions
- Call namespaceExists(name) first and skip creation if it returns true
- Catch MetaStoreNamespaceExistsException and treat it as a no-op when idempotent setup is intended
- Use a distinct namespace name if a genuinely new namespace is required
Example fix
// before
metaStore.createNamespace("pentaho"); // throws on second run
// after
if (!metaStore.namespaceExists("pentaho")) {
metaStore.createNamespace("pentaho");
} Defensive patterns
Strategy: validation
Validate before calling
if (!metaStore.namespaceExists(namespace)) {
metaStore.createNamespace(namespace);
} Try / catch
try { metaStore.createNamespace(ns); } catch (MetaStoreNamespaceExistsException e) { /* idempotent: already exists, ignore */ } Prevention
- Make setup code idempotent: check existence before create
- Serialize namespace creation in concurrent jobs to avoid races
- Use try/catch on MetaStoreNamespaceExistsException for one-time initialization scripts
When it happens
Trigger: metastore.createNamespace(name) where delegate.getNamespaceId(name) returns a non-null id, i.e. the namespace name already exists in the repository.
Common situations: Initialization code that runs on every startup calling createNamespace unconditionally; two jobs racing to create the same namespace; re-running a setup script after partial execution.
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
- Namespace ' ' can not be created, it already exists
- Can not create element type with id…
- Can not create element type with id
- Failed to create object in repository. Object
- Failed to create object in repository. Object
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/cd376bd3ad87959d.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java:79
for ( RowMetaAndData namespaceRow : namespaceRows ) {
String namespace = namespaceRow.getString( KettleDatabaseRepository.FIELD_NAMESPACE_NAME, null );
if ( !Utils.isEmpty( namespace ) ) {
namespaces.add( namespace );
}
}
return namespaces;
} catch ( Exception e ) {
throw new MetaStoreException( e );
}
}
@Override
public void createNamespace( String namespace ) throws MetaStoreException, MetaStoreNamespaceExistsException {
try {
ObjectId namespaceId = delegate.getNamespaceId( namespace );
if ( namespaceId != null ) {
throw new MetaStoreNamespaceExistsException( "Namespace with name '" + namespace + "' already exists" );
}
// insert namespace into R_NAMESPACE
//
delegate.insertNamespace( namespace );
repository.commit();
} catch ( Exception e ) {
repository.rollback();
throw new MetaStoreException( e );
}
}
@Override
public void deleteNamespace( String namespace ) throws MetaStoreException, MetaStoreDependenciesExistsException {
try {
ObjectId namespaceId = delegate.verifyNamespace( namespace );
List<IMetaStoreElementType> elementTypes = getElementTypes( namespace );View on GitHub (pinned to f3058517a1)