{"record":{"id":"bbd1683908d18c7b","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-element","errorCode":null,"errorMessage":"Unable to find element ","messagePattern":"Unable to find element ","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/spoon/dialog/MetaStoreExplorerDialog.java","lineNumber":224,"sourceCode":"      }\n    }\n  }\n\n  private void removeElement( String metaStoreName, String namespace, String elementTypeName, String elementName ) {\n\n    try {\n      IMetaStore metaStore = findMetaStore( metaStoreName );\n      if ( metaStore == null ) {\n        throw new MetaStoreException( \"Unable to find metastore '\" + metaStoreName + \"'\" );\n      }\n      IMetaStoreElementType elementType = metaStore.getElementTypeByName( namespace, elementTypeName );\n      if ( elementType == null ) {\n        throw new MetaStoreException( \"Unable to find element type '\"\n          + elementTypeName + \"' from metastore '\" + metaStoreName + \"' in namespace '\" + namespace + \"'\" );\n      }\n      IMetaStoreElement element = metaStore.getElementByName( namespace, elementType, elementName );\n      if ( element == null ) {\n        throw new MetaStoreException( \"Unable to find element '\"\n          + elementName + \"' of type '\" + elementTypeName + \"' from metastore '\" + metaStoreName\n          + \"' in namespace '\" + namespace + \"'\" );\n      }\n      metaStore.deleteElement( namespace, elementType, element.getId() );\n\n      refreshTree();\n\n    } catch ( MetaStoreException e ) {\n      new ErrorDialog( shell, \"Error removing element\", \"There was an error removing the element '\"\n        + elementName + \"' of type '\" + elementTypeName + \"' from metastore '\" + metaStoreName\n        + \"' in namespace '\" + namespace + \"'\", e );\n    }\n\n  }\n\n  private IMetaStore findMetaStore( String metaStoreName ) throws MetaStoreException {\n    for ( IMetaStore metaStore : metaStoreList ) {\n      if ( metaStore.getName() != null && metaStore.getName().equals( metaStoreName ) ) {","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/spoon/dialog/MetaStoreExplorerDialog.java#L206-L242","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Call refreshTree() (or reopen the dialog) so the tree reflects the current metastore state, then retry the delete.","Verify the element name and its element type exist in the namespace (e.g. list element types/elements via the metastore API) before deleting.","Confirm the dialog is pointed at the intended metastore and namespace; correct the selection and retry."],"exampleFix":"// before: delete from stale tree selection\nmetaStore.deleteElement( namespace, elementType, element.getId() );\n// after: re-check existence right before deleting\nIMetaStoreElement fresh = metaStore.getElementByName( namespace, elementType, elementName );\nif ( fresh != null ) {\n  metaStore.deleteElement( namespace, elementType, fresh.getId() );\n}\nrefreshTree();","handlingStrategy":"validation","validationCode":"if ( metaStore.getElementByName( namespace, elementType, elementName ) != null ) {\n  removeElement( namespace, elementTypeName, elementName );\n}","typeGuard":null,"tryCatchPattern":"try {\n  removeElement( namespace, elementTypeName, elementName );\n} catch ( MetaStoreException e ) {\n  log.logError( e.getMessage(), e );\n  refreshTree(); // re-sync UI with metastore state\n}","preventionTips":["Refresh the explorer tree before delete operations after any external metastore change.","Verify element existence with getElementByName before deleting.","Confirm the active metastore/namespace selection matches the element you intend to delete."],"tags":["metastore","pentaho-kettle","element-not-found","delete"],"backgroundTag":"resource-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}