pentaho/pentaho-kettle · error · MetaStoreException

The element to update with id

Error message

The element to update with id ${elementId} could not be found in the store

What it means

updateElement fetches the underlying repository file for the element by its elementId. If pur.getFileById(elementId) returns null, no element with that id exists in the PUR repository, so there is nothing to update and a MetaStoreException is thrown. This protects against updating nonexistent or already-deleted elements.

Solutions

  1. Re-fetch the element by name via getElementById/getElementsByElementType to obtain a current, valid elementId before updating.
  2. Check that the element still exists (getElementById(elementId) != null) before calling updateElement.
  3. Confirm you are connected to the same repository where the element was created.
  4. Handle the delete-then-update race by catching the exception and refreshing the element list.

Example fix

// before
metaStore.updateElement(namespace, elementType, elementId, element);
// after
IMetaStoreElement existing = metaStore.getElementById(namespace, elementType, elementId);
if (existing != null) {
  metaStore.updateElement(namespace, elementType, elementId, element);
}
Defensive patterns

Strategy: validation

Validate before calling

if (metaStore.getElementById(namespace, elementType, elementId) == null) {
  throw new IllegalStateException("Element " + elementId + " no longer exists");
}

Try / catch

try { metaStore.updateElement(...); }
catch (MetaStoreException e) { refreshElementList(); /* handle deleted element */ }

Prevention

When it happens

Trigger: Calling updateElement with an elementId that does not correspond to any existing repository file — typically a stale id from a deleted element or an id from a different repository.

Common situations: Another user/session deleted or moved the element between listing and updating; caching an elementId across repository connections; pointing at a different repository than where the element was created.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — 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/491efe142a7b619f. Report an issue: GitHub.

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/metastore/PurRepositoryMetaStore.java:341

  @Override
  public synchronized void updateElement( String namespace, IMetaStoreElementType elementType, String elementId,
      IMetaStoreElement element ) throws MetaStoreException {

    // verify that the element type belongs to this meta store
    //
    if ( elementType.getMetaStoreName() == null || !elementType.getName().equals( getName() ) ) {
      String elementTypeName = elementType.getName();
      elementType = getElementTypeByName( namespace, elementTypeName );
      if ( elementType == null ) {
        throw new MetaStoreException( "The element type '" + elementTypeName
            + "' could not be found in the meta store in which you are updating." );
      }
    }

    RepositoryFile existingFile = pur.getFileById( elementId );
    if ( existingFile == null ) {
      throw new MetaStoreException( "The element to update with id " + elementId + " could not be found in the store" );
    }

    DataNode elementDataNode = new DataNode( PurRepository.checkAndSanitize( element.getName() ) );
    elementToDataNode( element, elementDataNode );

    RepositoryFile updatedFile = pur.updateFile( existingFile, new NodeRepositoryFileData( elementDataNode ), null );
    element.setId( updatedFile.getId().toString() );
  }

  @Override
  public IMetaStoreElement getElement( String namespace, IMetaStoreElementType elementType, String elementId )
    throws MetaStoreException {
    NodeRepositoryFileData data = pur.getDataForRead( elementId, NodeRepositoryFileData.class );
    if ( data == null ) {
      return null;
    }

    IMetaStoreElement element = newElement();

View on GitHub (pinned to f3058517a1)