pentaho/pentaho-kettle · error · MetaStoreException
Unable to get element
Error message
Unable to get element
What it means
Generic wrapper thrown by getElement when fetching a single element by id fails with an unexpected exception. A missing element returns null (the null check precedes parsing), so this error means the lookup itself failed — repository query error, invalid id conversion, or parse failure. The cause exception holds the details.
Solutions
- Validate elementId is a valid ObjectId string taken from getElementIds(namespace, elementType).
- Inspect e.getCause() for the underlying database or conversion error and fix it.
- Confirm the id was issued by the same repository you are connected to.
- Handle null returns for genuinely missing ids instead of treating exceptions as not-found.
Example fix
// before IMetaStoreElement el = metastore.getElement(namespace, type, elementName); // name as id // after String id = metastore.getElementIds(namespace, type).stream() .filter(i -> name.equals(metastore.getElement(namespace, type, i).getName())) .findFirst().orElse(null); IMetaStoreElement el = id == null ? null : metastore.getElement(namespace, type, id);
Defensive patterns
Strategy: validation
Validate before calling
if (elementId == null || !metastore.getElementIds(namespace, elementType).contains(elementId)) {
return null;
} Try / catch
try {
return metastore.getElement(namespace, elementType, elementId);
} catch (MetaStoreException e) {
throw new IllegalArgumentException("Invalid element id or repository failure: " + e.getCause(), e);
} Prevention
- Pass ids from getElementIds, never element names
- Handle null as not-found instead of catching
- Keep full ObjectId strings intact in configuration
When it happens
Trigger: Calling getElement(namespace, elementType, elementId) where new LongObjectId(new StringObjectId(elementId)) conversion or delegate.getElement/parseElement throws — e.g. elementId is not a valid ObjectId string or the repository query fails.
Common situations: Passing an element name instead of its id string; id from another repository/namespace; truncated id in stored configuration; JDBC connectivity failure.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- Unable to get element by name
- Unable to get element type with id
- Error finding ID for directory [ + repositoryDirectory + ]…
- Unable to get element type with name
- Unable to get list of elements from namespace
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/ce2f8333adf807a2.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java:333
public List<String> getElementIds( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException {
List<String> ids = new ArrayList<String>();
List<IMetaStoreElement> elements = getElements( namespace, elementType );
for ( IMetaStoreElement element : elements ) {
ids.add( element.getId() );
}
return ids;
}
@Override
public IMetaStoreElement getElement( String namespace, IMetaStoreElementType elementType, String elementId ) throws MetaStoreException {
try {
RowMetaAndData elementRow = delegate.getElement( new LongObjectId( new StringObjectId( elementId ) ) );
if ( elementRow == null ) {
return null;
}
return delegate.parseElement( elementType, elementRow );
} catch ( Exception e ) {
throw new MetaStoreException( "Unable to get element", e );
}
}
@Override
public IMetaStoreElement getElementByName( String namespace, IMetaStoreElementType elementType, String name ) throws MetaStoreException {
try {
LongObjectId namespaceId = delegate.getNamespaceId( namespace );
if ( namespaceId == null ) {
return null;
}
LongObjectId elementTypeId = delegate.getElementTypeId( namespaceId, elementType.getName() );
if ( elementTypeId == null ) {
return null;
}
LongObjectId elementId = delegate.getElementId( elementTypeId, name );
if ( elementId == null ) {
return null;
}View on GitHub (pinned to f3058517a1)