pentaho/pentaho-kettle · error · MetaStoreException

Unable to get id of namespace 'namespace'

Error message

Unable to get id of namespace 'namespace'

What it means

While resolving the namespace id inside verifyNamespace, an underlying KettleException occurred (database access via getNamespaceId); it is wrapped in a MetaStoreException "Unable to get id of namespace '...'" with the cause attached.

Solutions

  1. Inspect the wrapped cause for the SQL error and fix connectivity/schema
  2. Ensure the metastore tables (R_ELEMENT_NAMESPACE etc.) exist — run the repository install/upgrade scripts
  3. Confirm the repository connection is healthy before metastore operations
  4. Retry after transient DB failures

Example fix

try {
  ObjectId nsId = delegate.verifyNamespace("myNamespace");
} catch (MetaStoreException e) {
  logError("DB failure resolving namespace", e.getCause());
}
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try { delegate.verifyNamespace(ns); } catch (MetaStoreException e) { logError("Metastore DB failure", e.getCause()); }

Prevention

When it happens

Trigger: getNamespaceId throws due to SQL failure on R_ELEMENT_NAMESPACE: connection error, missing table, schema mismatch.

Common situations: Metastore tables not installed in the repository database; DB connectivity failure; repository schema upgraded without the metastore extensions.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

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

   * @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(
      quoteTable( KettleDatabaseRepository.TABLE_R_ELEMENT ),
      quote( KettleDatabaseRepository.FIELD_ELEMENT_ID_ELEMENT ),
      quote( KettleDatabaseRepository.FIELD_ELEMENT_NAME ), elementName,
      new String[] { quote( KettleDatabaseRepository.FIELD_ELEMENT_ID_ELEMENT_TYPE ), },

View on GitHub (pinned to f3058517a1)