{"record":{"id":"f6c7c7791bd90267","repo":"pentaho/pentaho-kettle","slug":"unknown-element-type-element-getclass-getname","errorCode":null,"errorMessage":"unknown element type [\" + element.getClass().getName() + \"]","messagePattern":"unknown element type \\[\" \\+ element\\.getClass\\(\\)\\.getName\\(\\) \\+ \"\\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":2233,"sourceCode":"        filename += RepositoryObjectType.TRANSFORMATION.getExtension();\n        break;\n      case JOB:\n        filename += RepositoryObjectType.JOB.getExtension();\n        break;\n      case DATABASE:\n        filename += RepositoryObjectType.DATABASE.getExtension();\n        break;\n      case SLAVE_SERVER:\n        filename += RepositoryObjectType.SLAVE_SERVER.getExtension();\n        break;\n      case CLUSTER_SCHEMA:\n        filename += RepositoryObjectType.CLUSTER_SCHEMA.getExtension();\n        break;\n      case PARTITION_SCHEMA:\n        filename += RepositoryObjectType.PARTITION_SCHEMA.getExtension();\n        break;\n      default:\n        throw new KettleException( \"unknown element type [\" + element.getClass().getName() + \"]\" );\n    }\n    if ( !file.getName().equals( checkAndSanitize( filename ) ) ) {\n      return true;\n    }\n    return false;\n  }\n\n  private void renameIfNecessary( final RepositoryElementInterface element, final RepositoryFile file )\n    throws KettleException {\n    if ( !isRenamed( element, file ) ) {\n      return;\n    }\n\n    // ObjectId id = element.getObjectId();\n    StringBuilder buf = new StringBuilder( file.getPath().length() );\n    buf.append( getParentPath( file.getPath() ) );\n    buf.append( RepositoryFile.SEPARATOR );\n    buf.append( checkAndSanitize( element.getName() ) );","sourceCodeStart":2215,"sourceCodeEnd":2251,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L2215-L2251","documentation":"Thrown by the private isRenamed method of PurRepository when computing the expected filename for an element whose RepositoryObjectType has no extension mapping in the switch. Indicates the element type is unknown to the rename-detection logic.","triggerScenarios":"Calling PurRepository.save() with an element whose type enum is not TRANSFORMATION, JOB, DATABASE, CLUSTER_SCHEMA, PARTITION_SCHEMA, etc., so isRenamed's default case throws.","commonSituations":"Programmatically constructed repository elements with missing/wrong repositoryElementType; new element types added in a PDI version not handled by this pur adapter.","solutions":["Set a valid RepositoryObjectType on the element before saving","Use only supported element types with PurRepository","Upgrade the pur plugin to a version matching your element types"],"exampleFix":"// before\nelement.setRepositoryElementType(RepositoryObjectType.valueOf(\"MY_TYPE\"));\nrepository.save(element, null, null, null);\n// after\nelement.setRepositoryElementType(RepositoryObjectType.TRANSFORMATION);\nrepository.save(element, null, null, null);","handlingStrategy":"type-guard","validationCode":"RepositoryObjectType t = element.getRepositoryElementType();\nif (t == null) throw new IllegalArgumentException(\"Element has no repository type\");","typeGuard":"boolean hasKnownType(RepositoryElementInterface el) {\n  return el.getRepositoryElementType() != null;\n}","tryCatchPattern":"try {\n  repository.save(element, null, null, null);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"unknown element type\")) {\n    log.error(\"Set a valid RepositoryObjectType on \" + element.getClass().getName(), e);\n  }\n}","preventionTips":["Always set getRepositoryElementType() on custom elements","Avoid valueOf on unknown type strings","Keep pur plugin version in sync with PDI"],"tags":["pentaho","kettle","unsupported-type","rename"],"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"}