{"record":{"id":"fab865af22a7af51","repo":"pentaho/pentaho-kettle","slug":"unknown-type-typetoupdate","errorCode":null,"errorMessage":"unknown type [\" + typeToUpdate + \"]","messagePattern":"unknown type \\[\" \\+ typeToUpdate \\+ \"\\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":2880,"sourceCode":"          origSharedObjects = sharedObjectsByType.get( RepositoryObjectType.SLAVE_SERVER );\n          if ( !remove ) {\n            elementToUpdate = (RepositoryElementInterface) ( (SlaveServer) element ).clone();\n          }\n          break;\n        case CLUSTER_SCHEMA:\n          origSharedObjects = sharedObjectsByType.get( RepositoryObjectType.CLUSTER_SCHEMA );\n          if ( !remove ) {\n            elementToUpdate = ( (ClusterSchema) element ).clone();\n          }\n          break;\n        case PARTITION_SCHEMA:\n          origSharedObjects = sharedObjectsByType.get( RepositoryObjectType.PARTITION_SCHEMA );\n          if ( !remove ) {\n            elementToUpdate = (RepositoryElementInterface) ( (PartitionSchema) element ).clone();\n          }\n          break;\n        default:\n          throw new KettleException( \"unknown type [\" + typeToUpdate + \"]\" );\n      }\n\n      List<SharedObjectInterface<?>> newSharedObjects = new ArrayList<>( origSharedObjects );\n      // if there's a match on id, replace the element\n      boolean found = false;\n      for ( int i = 0; i < origSharedObjects.size(); i++ ) {\n        RepositoryElementInterface repositoryElementInterface = (RepositoryElementInterface) origSharedObjects.get( i );\n        if ( repositoryElementInterface == null ) {\n          continue;\n        }\n        ObjectId objectId = repositoryElementInterface.getObjectId();\n        if ( objectId != null && objectId.equals( idToFind ) ) {\n          if ( remove ) {\n            newSharedObjects.remove( i );\n          } else {\n            elementToUpdate.setObjectId( idToFind ); // because some clones don't clone the ID!!!\n            newSharedObjects.set( i, (SharedObjectInterface<?>) elementToUpdate );\n          }","sourceCodeStart":2862,"sourceCodeEnd":2898,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L2862-L2898","documentation":"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]'.","triggerScenarios":"Calling updateSharedObjectCache / removeFromSharedObjectCache with a RepositoryObjectType that is not a shared-object type — e.g. TRANSFORMATION, JOB, or a custom type.","commonSituations":"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.","solutions":["Only call the cache-update methods with shared-object types (DATABASE, PARTITION_SCHEMA, SLAVE_SERVER, CLUSTER_SCHEMA, etc.)","Guard the call site: skip cache updates for TRANSFORMATION/JOB types","Extend the switch statement if a new shared element type was introduced","Log and continue instead of throwing for non-shared types at the call site"],"exampleFix":"// before\nrepo.updateSharedObjectCache(transMeta, RepositoryObjectType.TRANSFORMATION, id); // throws unknown type\n// after\nif (type == RepositoryObjectType.DATABASE || type == RepositoryObjectType.PARTITION_SCHEMA\n    || type == RepositoryObjectType.SLAVE_SERVER || type == RepositoryObjectType.CLUSTER_SCHEMA) {\n  repo.updateSharedObjectCache(element, type, id);\n}","handlingStrategy":"validation","validationCode":"Set<RepositoryObjectType> SHARED_TYPES = Set.of(\n  RepositoryObjectType.DATABASE, RepositoryObjectType.PARTITION_SCHEMA,\n  RepositoryObjectType.SLAVE_SERVER, RepositoryObjectType.CLUSTER_SCHEMA);\nif (!SHARED_TYPES.contains(typeToUpdate)) {\n  return; // not a shared object; skip cache update\n}","typeGuard":"boolean isSharedObjectType(RepositoryObjectType t) {\n  return t == RepositoryObjectType.DATABASE\n      || t == RepositoryObjectType.PARTITION_SCHEMA\n      || t == RepositoryObjectType.SLAVE_SERVER\n      || t == RepositoryObjectType.CLUSTER_SCHEMA;\n}","tryCatchPattern":"try {\n  repo.updateSharedObjectCache(element, type, id);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"unknown type\")) {\n    log.warn(\"Skipping non-shared type: \" + type);\n  } else { throw e; }\n}","preventionTips":["Only invoke shared-object cache methods for shared element types","Skip TRANSFORMATION/JOB types at generic call sites","Extend the switch when adding new shared element types","Favor a whitelist over extending repository internals"],"tags":["pentaho-kettle","repository","shared-objects","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}