pentaho/pentaho-kettle · error · KettleException

unknown type [" + typeToUpdate + "]

Error message

unknown type [" + typeToUpdate + "]

What it means

PurRepository's shared-object cache update supports only known shared element types (databases, partition schemas, slaves, cluster schemas, etc.). Passing any other RepositoryObjectType falls into the switch's default branch and throws a KettleException 'unknown type [type]'.

Solutions

  1. Only call the cache-update methods with shared-object types (DATABASE, PARTITION_SCHEMA, SLAVE_SERVER, CLUSTER_SCHEMA, etc.)
  2. Guard the call site: skip cache updates for TRANSFORMATION/JOB types
  3. Extend the switch statement if a new shared element type was introduced
  4. Log and continue instead of throwing for non-shared types at the call site

Example fix

// before
repo.updateSharedObjectCache(transMeta, RepositoryObjectType.TRANSFORMATION, id); // throws unknown type
// after
if (type == RepositoryObjectType.DATABASE || type == RepositoryObjectType.PARTITION_SCHEMA
    || type == RepositoryObjectType.SLAVE_SERVER || type == RepositoryObjectType.CLUSTER_SCHEMA) {
  repo.updateSharedObjectCache(element, type, id);
}
Defensive patterns

Strategy: validation

Validate before calling

Set<RepositoryObjectType> SHARED_TYPES = Set.of(
  RepositoryObjectType.DATABASE, RepositoryObjectType.PARTITION_SCHEMA,
  RepositoryObjectType.SLAVE_SERVER, RepositoryObjectType.CLUSTER_SCHEMA);
if (!SHARED_TYPES.contains(typeToUpdate)) {
  return; // not a shared object; skip cache update
}

Type guard

boolean isSharedObjectType(RepositoryObjectType t) {
  return t == RepositoryObjectType.DATABASE
      || t == RepositoryObjectType.PARTITION_SCHEMA
      || t == RepositoryObjectType.SLAVE_SERVER
      || t == RepositoryObjectType.CLUSTER_SCHEMA;
}

Try / catch

try {
  repo.updateSharedObjectCache(element, type, id);
} catch (KettleException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("unknown type")) {
    log.warn("Skipping non-shared type: " + type);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling updateSharedObjectCache / removeFromSharedObjectCache with a RepositoryObjectType that is not a shared-object type — e.g. TRANSFORMATION, JOB, or a custom type.

Common situations: Generic repository code that updates the cache for every element type instead of only shared types; plugins registering new element types without extending the shared-object switch; refactorings that changed an element's type constant.

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/fab865af22a7af51. Report an issue: GitHub.

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java:2880

          origSharedObjects = sharedObjectsByType.get( RepositoryObjectType.SLAVE_SERVER );
          if ( !remove ) {
            elementToUpdate = (RepositoryElementInterface) ( (SlaveServer) element ).clone();
          }
          break;
        case CLUSTER_SCHEMA:
          origSharedObjects = sharedObjectsByType.get( RepositoryObjectType.CLUSTER_SCHEMA );
          if ( !remove ) {
            elementToUpdate = ( (ClusterSchema) element ).clone();
          }
          break;
        case PARTITION_SCHEMA:
          origSharedObjects = sharedObjectsByType.get( RepositoryObjectType.PARTITION_SCHEMA );
          if ( !remove ) {
            elementToUpdate = (RepositoryElementInterface) ( (PartitionSchema) element ).clone();
          }
          break;
        default:
          throw new KettleException( "unknown type [" + typeToUpdate + "]" );
      }

      List<SharedObjectInterface<?>> newSharedObjects = new ArrayList<>( origSharedObjects );
      // if there's a match on id, replace the element
      boolean found = false;
      for ( int i = 0; i < origSharedObjects.size(); i++ ) {
        RepositoryElementInterface repositoryElementInterface = (RepositoryElementInterface) origSharedObjects.get( i );
        if ( repositoryElementInterface == null ) {
          continue;
        }
        ObjectId objectId = repositoryElementInterface.getObjectId();
        if ( objectId != null && objectId.equals( idToFind ) ) {
          if ( remove ) {
            newSharedObjects.remove( i );
          } else {
            elementToUpdate.setObjectId( idToFind ); // because some clones don't clone the ID!!!
            newSharedObjects.set( i, (SharedObjectInterface<?>) elementToUpdate );
          }

View on GitHub (pinned to f3058517a1)