pentaho/pentaho-kettle · error · MetaStoreException

Unable to find namespace with name 'namespace'

Error message

Unable to find namespace with name 'namespace'

What it means

The metastore delegate could not resolve the requested namespace name to an id in the R_ELEMENT_NAMESPACE table, so verifyNamespace throws MetaStoreException. The namespace simply does not exist in the database metastore.

Solutions

  1. Create the namespace first (metastore.createNamespace(namespace)) before verifying/using it
  2. Check the exact namespace spelling/case against R_ELEMENT_NAMESPACE rows
  3. Point the KettleDatabaseRepositoryMetaStore at the database that actually contains the namespace
  4. Export/import metastore content from the source environment if migrating

Example fix

// before
ObjectId nsId = delegate.verifyNamespace("myNamespace"); // throws if absent
// after
if (delegate.getNamespaceId("myNamespace") == null) {
  metastore.createNamespace("myNamespace");
}
ObjectId nsId = delegate.verifyNamespace("myNamespace");
Defensive patterns

Strategy: validation

Validate before calling

if (repository.getMetaStore().getNamespaceId(namespace) == null /* or getNamespaces().contains(namespace) */) {
  metastore.createNamespace(namespace);
}

Type guard

boolean namespaceExists(IMetaStore store, String ns) { try { return store.getNamespaces().contains(ns); } catch (Exception e) { return false; } }

Try / catch

try { ObjectId id = delegate.verifyNamespace(ns); } catch (MetaStoreException e) { if (e.getMessage().contains("Unable to find namespace")) delegate.createNamespace(ns); }

Prevention

When it happens

Trigger: Calling verifyNamespace(namespace) (directly or via element/group type lookups) with a name that was never created, or after the namespace row was deleted.

Common situations: Typo in namespace name; metastore pointed at a fresh/empty database; environment migration where namespaces were not exported/imported; case-sensitivity mismatch on the name.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryMetaStoreDelegate.java:68

  /**
   * Retrieve the ID for a namespace
   *
   * @param namespace The namespace to look up
   * @return the ID of the namespace
   * @throws KettleException
   */
  public synchronized LongObjectId getNamespaceId( String namespace ) throws KettleException {
    return repository.connectionDelegate.getIDWithValue(
      quoteTable( KettleDatabaseRepository.TABLE_R_NAMESPACE ),
      quote( KettleDatabaseRepository.FIELD_NAMESPACE_ID_NAMESPACE ),
      quote( KettleDatabaseRepository.FIELD_NAMESPACE_NAME ), namespace );
  }

  public ObjectId verifyNamespace( String namespace ) throws MetaStoreException {
    try {
      ObjectId namespaceId = getNamespaceId( namespace );
      if ( namespaceId == null ) {
        throw new MetaStoreException( "Unable to find namespace with name '" + namespace + "'" );
      }
      return namespaceId;
    } catch ( KettleException e ) {
      throw new MetaStoreException( "Unable to get id of namespace '" + namespace + "'", e );
    }
  }

  public synchronized LongObjectId getElementTypeId( LongObjectId namespaceId, String elementTypeName ) throws KettleException {
    return repository.connectionDelegate.getIDWithValue(
      quoteTable( KettleDatabaseRepository.TABLE_R_ELEMENT_TYPE ),
      quote( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_ELEMENT_TYPE ),
      quote( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_NAME ), elementTypeName,
      new String[] { quote( KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_NAMESPACE ), },
      new ObjectId[] { namespaceId, } );
  }

  public synchronized LongObjectId getElementId( LongObjectId elementTypeId, String elementName ) throws KettleException {
    return repository.connectionDelegate.getIDWithValue(

View on GitHub (pinned to f3058517a1)