pentaho/pentaho-kettle · error · MetaStoreException

Unable to load database from element with name

Error message

Unable to load database from element with name '${name}' and type '${elementType}'

What it means

DatabaseMetaStoreUtil.getDatabaseElements() iterates all metastore elements of the database-connection type and converts each to a DatabaseMeta via loadDatabaseMetaFromDatabaseElement(). If any element fails to load, it aborts the whole iteration with a MetaStoreException naming the element and its type. It signals a corrupt or incompatible stored database connection element.

Solutions

  1. Inspect the named element in the metastore and fix or remove the corrupt entry
  2. Re-create the affected database connection element with valid attributes
  3. Migrate/upgrade metastore data to the current schema version
  4. Wrap per-element loading yourself by reading elements directly and skipping bad ones

Example fix

// before
databaseMeta.getURL() returns null because DB_ATTR_JDBC_URL is absent in the stored element
// after
re-save the connection via DatabaseMetaStoreUtil.databaseElement( metaStore, databaseMeta ) with all attributes populated
Defensive patterns

Strategy: validation

Validate before calling

for ( IMetaStoreElement el : metaStore.getElements( PentahoDefaults.NAMESPACE, dbType ) ) {
  if ( DatabaseMetaStoreUtil.getChildString( el, MetaStoreConst.DB_ATTR_ID_PLUGIN_ID ) == null
    && DatabaseMetaStoreUtil.getChildString( el, MetaStoreConst.DB_ATTR_DRIVER_CLASS ) == null ) {
    // skip or repair this element before calling getDatabaseElements
  }
}

Prevention

When it happens

Trigger: Calling getDatabaseElements(metaStore) when one element in the PentahoDefaults.NAMESPACE database type has missing/invalid attributes (e.g. bad URL, missing plugin_id) causing loadDatabaseMetaFromDatabaseElement to throw.

Common situations: Metastore data written by an older Pentaho version lacking newly required attributes; hand-edited metastore XML; partial writes from a previous crash.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — 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/d66177573c4d94c3. Report an issue: GitHub.

Appendix: source

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

  public static List<DatabaseMeta> getDatabaseElements( IMetaStore metaStore ) throws MetaStoreException {
    List<DatabaseMeta> databases = new ArrayList<DatabaseMeta>();

    // If the data type doesn't exist, it's an empty list...
    //
    IMetaStoreElementType elementType =
      metaStore.getElementTypeByName(
        PentahoDefaults.NAMESPACE, PentahoDefaults.DATABASE_CONNECTION_ELEMENT_TYPE_NAME );
    if ( elementType == null ) {
      return databases;
    }

    List<IMetaStoreElement> elements = metaStore.getElements( PentahoDefaults.NAMESPACE, elementType );
    for ( IMetaStoreElement element : elements ) {
      try {
        DatabaseMeta databaseMeta = loadDatabaseMetaFromDatabaseElement( metaStore, element );
        databases.add( databaseMeta );
      } catch ( Exception e ) {
        throw new MetaStoreException( "Unable to load database from element with name '"
          + element.getName() + "' and type '" + elementType.getName() + "'", e );
      }
    }

    return databases;
  }

  public static void createDatabaseElement( IMetaStore metaStore, DatabaseMeta databaseMeta ) throws MetaStoreException {

    // If the Pentaho namespace doesn't exist, create it!
    //
    if ( !metaStore.namespaceExists( PentahoDefaults.NAMESPACE ) ) {
      metaStore.createNamespace( PentahoDefaults.NAMESPACE );
    }

    // If the database connection element type doesn't exist, create it
    //
    IMetaStoreElementType elementType =

View on GitHub (pinned to f3058517a1)