pentaho/pentaho-kettle · error · MetaStoreException
Unable to create new element with name 'elementName'
Error message
Unable to create new element with name 'elementName'
What it means
This MetaStoreException is thrown by insertElement when any exception occurs while persisting a metastore element (and its attributes) into the Kettle database repository. The library wraps the underlying failure so callers get a consistent exception type, with the element name included for diagnosis and the original exception chained as the cause.
Solutions
- Inspect the chained cause (e.getCause()) to find the real JDBC/database error and fix that first
- Verify the repository database is reachable and the R_ELEMENT tables exist (run repository upgrade/repair)
- Check DB user permissions to INSERT into the metastore tables
- Shorten or sanitize the element name and retry
Example fix
// before
try { delegate.insertElement(element); } catch (MetaStoreException e) { log.error(e.getMessage()); }
// after
try { delegate.insertElement(element); } catch (MetaStoreException e) {
Throwable cause = e.getCause();
log.error("Failed to create element " + element.getName() + ": " + (cause != null ? cause.getMessage() : e.getMessage()), e);
// fix root cause (connection/schema/permissions) then retry
} Defensive patterns
Strategy: try-catch
Validate before calling
if (element == null || element.getName() == null || element.getName().isEmpty()) throw new IllegalArgumentException("Element name required before insertElement");
// also verify repository connection: if (!repository.isConnected()) reconnect(); Type guard
boolean isInsertable(org.pentaho.metastore.api.IMetaStoreElement e) { return e != null && e.getName() != null && !e.getName().isEmpty(); } Try / catch
try { delegate.insertElement(element); } catch (MetaStoreException e) { Throwable c = e.getCause(); log.error("insertElement failed for '" + element.getName() + "': " + (c != null ? c.getMessage() : ""), e); throw e; } Prevention
- Always inspect the chained cause of MetaStoreException — it carries the real DB error
- Keep the repository schema upgraded to match your Pentaho version
- Monitor DB connectivity before bulk metastore writes
- Keep element names within the R_ELEMENT column length
When it happens
Trigger: Calling KettleDatabaseRepositoryMetaStoreDelegate.insertElement(element) when the underlying JDBC insert fails: e.g. repository database connection lost, R_ELEMENT/ R_ELEMENT_ATTRIBUTE tables missing or corrupted, name column too long, or insertAttributes throwing while writing children.
Common situations: Database down or network blip mid-save; repository schema not upgraded after a Pentaho version change; element name containing characters that break the stored column length; insufficient DB permissions on the metastore tables.
Related errors
- Unable to get element type with name
- Unable to get list of element types for namespace
- Unable to save element type in the database repository
- AbortMeta.Exception.UnableToSaveStepInfoToRepository
- AccessInputMeta.Exception.ErrorReadingRepository
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/9c457d5bfd695407.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryMetaStoreDelegate.java:461
repository.connectionDelegate.getDatabase().prepareInsert(
table.getRowMeta(), KettleDatabaseRepository.TABLE_R_ELEMENT );
repository.connectionDelegate.getDatabase().setValuesInsert( table );
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
element.setId( elementId.toString() );
// Now save the attributes
//
insertAttributes( element.getChildren(), elementId, new LongObjectId( 0L ) );
if ( log.isDebug() ) {
log.logDebug( "Saved element with name [" + element.getName() + "]" );
}
return elementId;
} catch ( Exception e ) {
throw new MetaStoreException( "Unable to create new element with name '" + element.getName() + "'", e );
}
}
private void insertAttributes( List<IMetaStoreAttribute> children, LongObjectId elementId,
LongObjectId parentAttributeId ) throws Exception {
for ( IMetaStoreAttribute child : children ) {
LongObjectId attributeId =
repository.connectionDelegate.getNextID(
quoteTable( KettleDatabaseRepository.TABLE_R_ELEMENT_ATTRIBUTE ),
quote( KettleDatabaseRepository.FIELD_ELEMENT_ATTRIBUTE_ID_ELEMENT_ATTRIBUTE ) );
RowMetaAndData table = new RowMetaAndData();
table.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_ELEMENT_ATTRIBUTE_ID_ELEMENT_ATTRIBUTE ), attributeId.longValue() );
table.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_ELEMENT_ATTRIBUTE_ID_ELEMENT ),View on GitHub (pinned to f3058517a1)