pentaho/pentaho-kettle · error · MetaStoreException
Unexpected error creating an element in the shared objects…
Error message
Unexpected error creating an element in the shared objects meta store
What it means
createElement() wraps any exception thrown during element creation (duplicate checks, DatabaseMeta conversion, shared-objects storeObject/saveToFile IO) into MetaStoreException with the generic message 'Unexpected error creating an element in the shared objects meta store'. The original cause is attached as the exception cause.
Solutions
- Inspect e.getCause() of the MetaStoreException for the root error
- Verify the shared objects file is writable and not corrupt (restore from .backup if needed)
- Check for duplicate element names first (the duplicate error is re-wrapped here)
- Validate the IMetaStoreElement content before calling createElement
Example fix
// before
} catch ( Exception e ) {
throw new MetaStoreException( "Unexpected error creating...", e );
}
// after
} catch ( MetaStoreElementExistException e ) {
throw e; // preserve specific error
} catch ( Exception e ) {
throw new MetaStoreException( "Unexpected error creating...", e );
} Defensive patterns
Strategy: try-catch
Validate before calling
if ( metaStore.getElementByName( ns, elementType, element.getName() ) != null ) {
throw new IllegalStateException( "Duplicate element name: " + element.getName() );
}
java.io.File f = new java.io.File( sharedObjects.getFilename() );
if ( !f.getParentFile().canWrite() ) throw new IllegalStateException( "Shared objects dir not writable" ); Try / catch
try {
metaStore.createElement( ns, type, element );
} catch ( MetaStoreException e ) {
Throwable root = e;
while ( root.getCause() != null ) root = root.getCause();
logger.error( "Element creation failed; root cause: {}", root.getMessage(), e );
} Prevention
- Always read e.getCause() — the top message is generic by design
- Pre-check duplicates and file writability before creation
- Log the full exception chain, not just getMessage()
When it happens
Trigger: Any failure inside createElement: the duplicate-name MetaStoreException itself is caught and re-wrapped, DatabaseMetaStoreUtil.loadDatabaseMetaFromDatabaseElement throwing during conversion, storeObject() failing, or saveToFile() failing on IO errors.
Common situations: Corrupt shared.xml files, write-protected ~/.kettle directory, malformed element XML passed in, or duplicate-name exceptions being masked by the generic wrapper.
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
- Unexpected error deleting an element in the shared objects…
- Calculator.ErrorInStepRunning
- Function call replace is not valid : " + e.getMessage()
- GPLoadMeta.Exception.ErrorGettingFields
- JobExecutorMeta.Exception.UnableToLoadJob
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/d7d6ff5fc8a2d1ce.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/shared/SharedObjectsMetaStore.java:176
public void createElement( String namespace, IMetaStoreElementType elementType, IMetaStoreElement element ) throws MetaStoreException, MetaStoreElementExistException {
try {
IMetaStoreElement exists = getElementByName( namespace, elementType, element.getId() );
if ( exists != null ) {
throw new MetaStoreException( "The shared objects meta store already contains an element with type name '"
+ elementType.getName() + "' and element name '" + element.getName() );
}
if ( elementType.getName().equals( databaseElementType.getName() ) ) {
// convert the element to DatabaseMeta and store it in the shared objects file, then save the file
//
sharedObjects.storeObject( DatabaseMetaStoreUtil.loadDatabaseMetaFromDatabaseElement( this, element ) );
sharedObjects.saveToFile();
return;
}
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() {View on GitHub (pinned to f3058517a1)