pentaho/pentaho-kettle · error · MetaStoreException

Unable to create element with name

Error message

Unable to create element with name '{}' of type '{}'

What it means

Generic MetaStoreException wrapper from createElement: any unexpected exception while inserting the element row into the repository database (other than the duplicate-name case) is re-thrown with this message, after repository.rollback(). The original cause is attached as the cause of the Kettle/MetaStore exception.

Solutions

  1. Inspect the cause (e.getCause()) for the real database error and fix that root cause
  2. Verify repository DB connectivity and credentials
  3. Validate the element's properties/attributes are populated and within DB limits before insert
  4. Retry the operation after a transient DB failure; the rollback leaves state clean

Example fix

// before
try { metastore.createElement(ns, type, element); } catch (MetaStoreException e) { throw e; }
// after
try { metastore.createElement(ns, type, element); }
catch (MetaStoreException e) {
  LOG.error("create failed, root cause:", e.getCause());
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (element.getName() == null || element.getName().isEmpty()) {
  throw new IllegalArgumentException("Element name required before insert");
}

Try / catch

try {
  metastore.createElement(namespace, elementType, element);
} catch (MetaStoreException e) {
  Throwable root = e.getCause();
  LOG.error("Element insert failed, cause: " + (root == null ? "none" : root.getMessage()), e);
  throw e;
}

Prevention

When it happens

Trigger: delegate.insertElement fails (DB connection lost, constraint violation other than name, bad element structure/attributes), or repository.commit() throws; createElement then rolls back and wraps the cause.

Common situations: Repository database down or connection dropped mid-operation; element containing attribute values too large for the column; malformed element objects built programmatically; transaction deadlocks.

Related errors


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

Appendix: source

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

    }
  }

  @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 ) {
      repository.rollback();
      throw new MetaStoreException( "Unable to create element with name '"
        + element.getName() + "' of type '" + elementType.getName() + "'", e );
    }
  }

  @Override
  public void deleteElement( String namespace, IMetaStoreElementType elementType, String elementId ) throws MetaStoreException {
    try {
      IMetaStoreElementType type = getElementTypeByName( namespace, elementType.getName() );
      if ( type == null ) {
        throw new MetaStoreException( "Unable to find element type with name '" + elementType.getName() + "'" );
      }

      delegate.deleteElement( new LongObjectId( new StringObjectId( elementId ) ) );
      repository.commit();
    } catch ( Exception e ) {
      repository.rollback();
      throw new MetaStoreException( "Unable to delete element with id '"
        + elementId + "' of type '" + elementType.getName() + "'", e );

View on GitHub (pinned to f3058517a1)