pentaho/pentaho-kettle · error · MetaStoreException

Storing elements with element type name

Error message

Storing elements with element type name '{}' is not supported in the shared objects meta store

What it means

The shared-objects metastore can only persist elements whose element type maps to a known shared object type (currently DatabaseMeta). createElement() throws MetaStoreException for any other element type name because there is no backing storage for it.

Solutions

  1. Only store DatabaseMeta-type elements in this metastore
  2. Use MemoryMetaStore or a database-backed metastore for other element types
  3. Extend the metastore by adding another element-type branch (like databaseElementType) if you own the code

Example fix

// before
metaStore.createElement( ns, customType, element ); // throws
// after
if ( metaStore instanceof SharedObjectsMetaStore && !"Database".equals( customType.getName() ) ) {
  throw new IllegalArgumentException( "Use a writable metastore for type " + customType.getName() );
}
Defensive patterns

Strategy: validation

Validate before calling

boolean isDatabaseType = "Database".equals( elementType.getName() );
if ( metaStore instanceof SharedObjectsMetaStore && !isDatabaseType ) {
  throw new IllegalArgumentException( "SharedObjectsMetaStore only stores Database-type elements" );
}

Type guard

boolean canStoreInSharedObjects = metaStore instanceof SharedObjectsMetaStore
  && "Database".equals( elementType.getName() );

Try / catch

try {
  metaStore.createElement( ns, type, element );
} catch ( MetaStoreException e ) {
  if ( e.getMessage() != null && e.getMessage().contains( "not supported" ) ) {
    fallbackMetaStore.createElement( ns, type, element );
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling createElement with an elementType whose name is not the built-in database type, e.g. custom or governance element types.

Common situations: Storing PartitionSchemas, ClusterSchemas, or custom plugin metadata via the shared-objects metastore; porting code from a full metastore that supported arbitrary types.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/shared/SharedObjectsMetaStore.java:173

  }

  @Override
  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 );
    }

View on GitHub (pinned to f3058517a1)