pentaho/pentaho-kettle · error · MetaStoreException

Unexpected error deleting an element in the shared objects…

Error message

Unexpected error deleting an element in the shared objects meta store

What it means

deleteElement() wraps any exception thrown while removing an element (element lookup, DatabaseMeta conversion via DatabaseMetaStoreUtil, removeObject, or saveToFile) into MetaStoreException with the message 'Unexpected error deleting an element in the shared objects meta store', attaching the original cause.

Solutions

  1. Confirm the element id exists via getElement()/getElementByName() before deleting
  2. Check the shared objects file is writable and uncorrupted
  3. Inspect e.getCause() to identify the underlying lookup or IO failure

Example fix

// before
metaStore.deleteElement( ns, type, elementId );
// after
if ( metaStore.getElement( ns, type, elementId ) != null ) {
  try {
    metaStore.deleteElement( ns, type, elementId );
  } catch ( MetaStoreException e ) {
    log.error( "Delete failed: " + e.getCause(), e );
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

if ( metaStore.getElement( ns, elementType, elementId ) == null ) {
  return; // nothing to delete
}

Try / catch

try {
  metaStore.deleteElement( ns, type, elementId );
} catch ( MetaStoreException e ) {
  Throwable root = e;
  while ( root.getCause() != null ) root = root.getCause();
  logger.error( "Element delete failed; root cause: {}", root.getMessage(), e );
}

Prevention

When it happens

Trigger: Calling deleteElement for a database-type element when getElement() cannot find the id, the DatabaseMeta conversion fails, or saveToFile() throws on IO errors (permissions, disk full).

Common situations: Deleting a connection that no longer exists in shared.xml; read-only or locked shared.xml; corrupted element data preventing conversion back to DatabaseMeta.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/shared/SharedObjectsMetaStore.java:190

      }
      throw new MetaStoreException( "Storing elements with element type name '"
        + elementType.getName() + "' is not supported in the shared objects meta store" );
    } catch ( Exception e ) {
      throw new MetaStoreException( "Unexpected error creating an element in the shared objects meta store", e );
    }
  }

  @Override
  public void deleteElement( String namespace, IMetaStoreElementType elementType, String elementId ) throws MetaStoreException {
    try {
      if ( elementType.getName().equals( databaseElementType.getName() ) ) {
        sharedObjects.removeObject( DatabaseMetaStoreUtil.loadDatabaseMetaFromDatabaseElement( this, getElement(
          namespace, elementType, elementId ) ) );
        sharedObjects.saveToFile();
        return;
      }
    } catch ( Exception e ) {
      throw new MetaStoreException( "Unexpected error deleting an element in the shared objects meta store", e );
    }
  }

  public SharedObjects getSharedObjects() {
    return sharedObjects;
  }

  public void setSharedObjects( SharedObjects sharedObjects ) {
    this.sharedObjects = sharedObjects;
  }

}

View on GitHub (pinned to f3058517a1)