pentaho/pentaho-kettle · error · MetaStoreException

Unable to update element with id

Error message

Unable to update element with id '{}' called '{}' in type '{}'

What it means

Thrown by updateElement when its delete-then-create implementation fails for any reason. The method deletes the old element by id, re-creates it, and commits; any exception (including wrapped errors 1131-1133) is rolled back and re-thrown as this MetaStoreException naming id, name and type.

Solutions

  1. Ensure the new element name is unique within namespace/type before updating
  2. Verify elementId and elementType are current (fetch fresh objects from the metastore)
  3. Inspect getCause() to see whether delete or create failed and fix that specific issue
  4. Retry after rollback — the whole update is atomic, so state is unchanged

Example fix

// before
metastore.updateElement(ns, type, id, element);
// after
String newName = element.getName();
IMetaStoreElement dup = metastore.getElementByName(ns, type, newName);
if (dup == null || id.equals(dup.getId())) {
  metastore.updateElement(ns, type, id, element);
}
Defensive patterns

Strategy: try-catch

Validate before calling

IMetaStoreElement dup = metastore.getElementByName(namespace, elementType, element.getName());
if (dup != null && !elementId.equals(dup.getId())) {
  throw new IllegalStateException("Name collision on update: " + element.getName());
}

Try / catch

try {
  metastore.updateElement(namespace, elementType, elementId, element);
} catch (MetaException | MetaStoreException e) {
  LOG.error("Update of " + elementId + " failed, cause: " + e.getCause(), e);
  throw e;
}

Prevention

When it happens

Trigger: updateElement(namespace, elementType, elementId, element) where the internal deleteElement or createElement throws (duplicate name, missing type, bad id, DB failure), or repository.commit() fails.

Common situations: Renaming an element to a name that already exists (create-half collides); passing an elementId that no longer exists; DB connection loss between delete and create; concurrent updates to the same element.

Related errors


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

Appendix: source

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

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

  @Override
  public void updateElement( String namespace, IMetaStoreElementType elementType, String elementId,
    IMetaStoreElement element ) throws MetaStoreException {
    try {
      // This is a delete/insert operation
      //
      deleteElement( namespace, elementType, elementId );
      createElement( namespace, elementType, element );
      repository.commit();
    } catch ( Exception e ) {
      repository.rollback();
      throw new MetaStoreException( "Unable to update element with id '"
        + elementId + "' called '" + element.getName() + "' in type '" + elementType.getName() + "'", e );
    }
  }

  @Override
  public IMetaStoreElementType newElementType( String namespace ) throws MetaStoreException {
    return new KDBRMetaStoreElementType( delegate, namespace, null, null, null );
  }

  @Override
  public IMetaStoreElement newElement() throws MetaStoreException {
    return new KDBRMetaStoreElement();
  }

  @Override
  public IMetaStoreElement newElement( IMetaStoreElementType elementType, String id, Object value ) throws MetaStoreException {
    return new KDBRMetaStoreElement( delegate, elementType, id, value );
  }

View on GitHub (pinned to f3058517a1)