pentaho/pentaho-kettle · error · MetaStoreException

Unable to find element

Error message

Unable to find element 

What it means

MetaStoreExplorerDialog.removeElement throws MetaStoreException when the named element type or the named element cannot be resolved in the metastore namespace before attempting deleteElement. The library refuses to delete an object it cannot locate, since deletion requires the element's ID. The message names the missing element, its type, the metastore, and the namespace.

Solutions

  1. Call refreshTree() (or reopen the dialog) so the tree reflects the current metastore state, then retry the delete.
  2. Verify the element name and its element type exist in the namespace (e.g. list element types/elements via the metastore API) before deleting.
  3. Confirm the dialog is pointed at the intended metastore and namespace; correct the selection and retry.

Example fix

// before: delete from stale tree selection
metaStore.deleteElement( namespace, elementType, element.getId() );
// after: re-check existence right before deleting
IMetaStoreElement fresh = metaStore.getElementByName( namespace, elementType, elementName );
if ( fresh != null ) {
  metaStore.deleteElement( namespace, elementType, fresh.getId() );
}
refreshTree();
Defensive patterns

Strategy: validation

Validate before calling

if ( metaStore.getElementByName( namespace, elementType, elementName ) != null ) {
  removeElement( namespace, elementTypeName, elementName );
}

Try / catch

try {
  removeElement( namespace, elementTypeName, elementName );
} catch ( MetaStoreException e ) {
  log.logError( e.getMessage(), e );
  refreshTree(); // re-sync UI with metastore state
}

Prevention

When it happens

Trigger: Calling removeElement (via the delete button's widgetSelected handler) when metaStore.getElementByName(namespace, elementType, elementName) returns null — the element name does not exist under that element type/namespace, or the element type itself is null for the namespace.

Common situations: The element was deleted from another session or by another user before the tree was refreshed; the user renamed the element so the cached tree label no longer matches; the dialog was opened against a different metastore/namespace than the one that owns the element.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at ui/src/main/java/org/pentaho/di/ui/spoon/dialog/MetaStoreExplorerDialog.java:224

      }
    }
  }

  private void removeElement( String metaStoreName, String namespace, String elementTypeName, String elementName ) {

    try {
      IMetaStore metaStore = findMetaStore( metaStoreName );
      if ( metaStore == null ) {
        throw new MetaStoreException( "Unable to find metastore '" + metaStoreName + "'" );
      }
      IMetaStoreElementType elementType = metaStore.getElementTypeByName( namespace, elementTypeName );
      if ( elementType == null ) {
        throw new MetaStoreException( "Unable to find element type '"
          + elementTypeName + "' from metastore '" + metaStoreName + "' in namespace '" + namespace + "'" );
      }
      IMetaStoreElement element = metaStore.getElementByName( namespace, elementType, elementName );
      if ( element == null ) {
        throw new MetaStoreException( "Unable to find element '"
          + elementName + "' of type '" + elementTypeName + "' from metastore '" + metaStoreName
          + "' in namespace '" + namespace + "'" );
      }
      metaStore.deleteElement( namespace, elementType, element.getId() );

      refreshTree();

    } catch ( MetaStoreException e ) {
      new ErrorDialog( shell, "Error removing element", "There was an error removing the element '"
        + elementName + "' of type '" + elementTypeName + "' from metastore '" + metaStoreName
        + "' in namespace '" + namespace + "'", e );
    }

  }

  private IMetaStore findMetaStore( String metaStoreName ) throws MetaStoreException {
    for ( IMetaStore metaStore : metaStoreList ) {
      if ( metaStore.getName() != null && metaStore.getName().equals( metaStoreName ) ) {

View on GitHub (pinned to f3058517a1)