pentaho/pentaho-kettle · error · MetaStoreException

Namespace ' ' doesn't exist.

Error message

Namespace '${namespace}' doesn't exist.

What it means

populateDatabaseElement() requires the Pentaho default metastore namespace to exist before storing a database connection. If metaStore.namespaceExists(PentahoDefaults.NAMESPACE) is false it throws this MetaStoreException. The namespace must be created explicitly before persisting connection metadata.

Solutions

  1. Create the namespace first: metaStore.createNamespace( PentahoDefaults.NAMESPACE )
  2. Call DatabaseMetaStoreUtil.populateDatabaseElementType() (or equivalent init) which ensures the namespace and element type exist
  3. Point the application at the intended, initialized metastore location

Example fix

// before
IMetaStoreElement el = DatabaseMetaStoreUtil.databaseElement( metaStore, dbMeta ); // throws
// after
if ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {
  metaStore.createNamespace( PentahoDefaults.NAMESPACE );
}
IMetaStoreElement el = DatabaseMetaStoreUtil.databaseElement( metaStore, dbMeta );
Defensive patterns

Strategy: validation

Validate before calling

if ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {
  metaStore.createNamespace( PentahoDefaults.NAMESPACE );
}

Prevention

When it happens

Trigger: Calling populateDatabaseElement() or databaseElement() on a fresh/empty IMetaStore where the PentahoDefaults.NAMESPACE namespace was never created.

Common situations: New in-memory or file metastore used without running initialization code; metastore directory wiped or pointed to a new empty location; custom metastore implementation that does not pre-create namespaces.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/metastore/DatabaseMetaStoreUtil.java:110

  }

  public static IMetaStoreElementType populateDatabaseElementType( IMetaStore metaStore ) throws MetaStoreException {

    // The new type will typically have an ID so all we need to do is give the type a name and a description.
    //
    IMetaStoreElementType elementType = metaStore.newElementType( PentahoDefaults.NAMESPACE );

    // Name and description...
    //
    elementType.setName( PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_NAME );
    elementType.setDescription( PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_DESCRIPTION );
    return elementType;
  }

  public static IMetaStoreElement populateDatabaseElement( IMetaStore metaStore, DatabaseMeta databaseMeta ) throws MetaStoreException {

    if ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {
      throw new MetaStoreException( "Namespace '" + PentahoDefaults.NAMESPACE + "' doesn't exist." );
    }

    // If the data type doesn't exist, error out...
    //
    IMetaStoreElementType elementType =
      metaStore.getElementTypeByName(
        PentahoDefaults.NAMESPACE, PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_NAME );
    if ( elementType == null ) {
      throw new MetaStoreException( "Unable to find the database connection type" );
    }

    elementType = populateDatabaseElementType( metaStore );

    // generate a new database element and populate it with metadata
    //
    IMetaStoreElement element = metaStore.newElement( elementType, databaseMeta.getName(), null );

    element.addChild( metaStore.newAttribute( MetaStoreConst.DB_ATTR_ID_PLUGIN_ID, databaseMeta.getPluginId() ) );

View on GitHub (pinned to f3058517a1)