pentaho/pentaho-kettle · error · MetaStoreException

Unable to get element by name

Error message

Unable to get element by name '<name>' from namespace '<namespace>'

What it means

Wrapper thrown by getElementByName when resolving an element by name within a namespace and element type fails with an unexpected exception. The flow verifies the namespace, resolves the type, queries the element id by name, and parses the row; any delegate failure is wrapped in MetaStoreException. A name that does not exist returns null rather than throwing.

Solutions

  1. Check e.getCause() for the JDBC failure; restore connectivity and retry.
  2. Reload elementType via getElementTypeByName(namespace, typeName) to ensure a fresh, valid id.
  3. Verify the namespace exists before lookup to narrow the failure source.
  4. Treat null (not an exception) as not-found; repair corrupted repository tables if parse errors persist.

Example fix

// before
IMetaStoreElement el = metastore.getElementByName(namespace, type, name); // may throw

// after
try {
  IMetaStoreElement el = metastore.getElementByName(namespace, type, name);
} catch (MetaStoreException e) {
  log.error("Lookup failed for '" + name + "': " + e.getCause(), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (elementType.getId() == null) {
  elementType = metastore.getElementTypeByName(namespace, elementType.getName());
  if (elementType == null) return null;
}

Try / catch

try {
  return metastore.getElementByName(namespace, elementType, name);
} catch (MetaStoreException e) {
  log.error("Element lookup failed for '{}': {}", name, e.getCause(), e);
  return null;
}

Prevention

When it happens

Trigger: Calling getElementByName(namespace, elementType, name) where the namespace verification, id-by-name query, or delegate.parseElement throws — repository connection failure, malformed elementType, or unparseable rows.

Common situations: Database outage during element lookup; elementType object from a stale/other namespace so resolution fails; corrupted element rows after interrupted writes; concurrent deletion between id lookup and parse.

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/024d9569157c49df. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java:359

      if ( namespaceId == null ) {
        return null;
      }
      LongObjectId elementTypeId = delegate.getElementTypeId( namespaceId, elementType.getName() );
      if ( elementTypeId == null ) {
        return null;
      }
      LongObjectId elementId = delegate.getElementId( elementTypeId, name );
      if ( elementId == null ) {
        return null;
      }
      RowMetaAndData elementRow = delegate.getElement( elementId );
      if ( elementRow == null ) {
        return null;
      }

      return delegate.parseElement( elementType, elementRow );
    } catch ( Exception e ) {
      throw new MetaStoreException( "Unable to get element by name '"
        + name + "' from namespace '" + namespace + "'", e );
    }
  }

  @Override
  public void createElement( String namespace, IMetaStoreElementType elementType, IMetaStoreElement element ) throws MetaStoreException, MetaStoreElementExistException {
    try {
      IMetaStoreElement found = getElementByName( namespace, elementType, element.getName() );
      if ( found != null ) {
        throw new MetaStoreElementExistException( Arrays.asList( found ), "The element with name '"
          + element.getName() + "' already exists" );
      }

      delegate.insertElement( elementType, element );
      repository.commit();
    } catch ( MetaStoreElementExistException e ) {
      throw e;
    } catch ( Exception e ) {

View on GitHub (pinned to f3058517a1)