pentaho/pentaho-kettle · error · MetaStoreException

Unable to save element type in the database repository

Error message

Unable to save element type in the database repository

What it means

KDBRMetaStoreElementType.save() persists an element type via delegate.insertElementType(); any exception is rethrown as MetaStoreException('Unable to save element type in the database repository', cause). It means the metadata element type could not be written to the repository's metastore tables (R_ELEMENT_TYPE etc.).

Solutions

  1. Check the chained cause exception for the actual DB error
  2. Verify the parent namespace exists (createNamespace first) and is committed
  3. Ensure the repository schema includes the metastore tables (upgrade/create the repository)

Example fix

// before
metaStore.createElementType(ns, elementType); // opaque failure
// after
if (metaStore.namespaceExists(ns)) {
  metaStore.createElementType(ns, elementType);
} else {
  metaStore.createNamespace(ns);
  metaStore.createElementType(ns, elementType);
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!metaStore.namespaceExists(namespace)) metaStore.createNamespace(namespace);

Try / catch

try { elementType.save(); } catch (MetaStoreException e) { log("Element type save failed: " + e.getCause()); throw e; }

Prevention

When it happens

Trigger: metastore.createElementType(namespace, elementType) (which calls save()) when insertElementType throws — e.g. namespace missing, DB error, duplicate element type name in the namespace.

Common situations: Calling createElementType on a namespace that was never created; repository connection lost mid-session; metastore schema not created in the target repository.

Related errors


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

Appendix: source

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

  private String description;
  private LongObjectId objectId;
  private KettleDatabaseRepositoryMetaStoreDelegate delegate;

  public KDBRMetaStoreElementType( KettleDatabaseRepositoryMetaStoreDelegate delegate, String namespace,
    ObjectId namespaceId, String name, String description ) {
    this.delegate = delegate;
    this.namespace = namespace;
    this.namespaceId = namespaceId;
    this.name = name;
    this.description = description;
  }

  @Override
  public void save() throws MetaStoreException {
    try {
      delegate.insertElementType( this );
    } catch ( Exception e ) {
      throw new MetaStoreException( "Unable to save element type in the database repository", e );
    }
  }

  @Override
  public String getId() {
    return objectId != null ? objectId.toString() : null;
  }

  @Override
  public void setId( String id ) {
    this.objectId = new LongObjectId( new StringObjectId( id ) );
  }

  public String getMetaStoreName() {
    return metaStoreName;
  }

  public void setMetaStoreName( String metaStoreName ) {

View on GitHub (pinned to f3058517a1)