{"record":{"id":"293038ae619052bb","repo":"pentaho/pentaho-kettle","slug":"it-s-not-possible-to-save-class-element-getclass-getname-to","errorCode":null,"errorMessage":"It's not possible to save Class [\" + element.getClass().getName() + \"] to the repository","messagePattern":"It's not possible to save Class \\[\" \\+ element\\.getClass\\(\\)\\.getName\\(\\) \\+ \"\\] to the repository","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":2199,"sourceCode":"          saveTrans( element, versionComment, versionDate );\n          break;\n        case JOB:\n          saveJob( element, versionComment, versionDate );\n          break;\n        case DATABASE:\n          saveDatabaseMeta( element, versionComment, versionDate );\n          break;\n        case SLAVE_SERVER:\n          saveSlaveServer( element, versionComment, versionDate );\n          break;\n        case CLUSTER_SCHEMA:\n          saveClusterSchema( element, versionComment, versionDate );\n          break;\n        case PARTITION_SCHEMA:\n          savePartitionSchema( element, versionComment, versionDate );\n          break;\n        default:\n          throw new KettleException(\n            \"It's not possible to save Class [\" + element.getClass().getName() + \"] to the repository\" );\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to save repository element [\" + element + \"]\", e );\n    }\n  }\n\n  private boolean isRenamed( final RepositoryElementInterface element, final RepositoryFile file )\n    throws KettleException {\n    if ( element.getObjectId() == null ) {\n      return false; // never been saved\n    }\n    String filename = element.getName();\n    switch ( element.getRepositoryElementType() ) {\n      case TRANSFORMATION:\n        filename += RepositoryObjectType.TRANSFORMATION.getExtension();\n        break;\n      case JOB:","sourceCodeStart":2181,"sourceCodeEnd":2217,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L2181-L2217","documentation":"Thrown by PurRepository.saveRepositoryElement when the element's RepositoryObjectType is not one of the handled types (e.g. not a Job, Transformation, Database, Cluster Schema, Partition Schema, etc.). The switch statement hits its default case because this repository adapter does not support saving that class.","triggerScenarios":"Calling PurRepository.save(element, versionComment, calendar, monitor) with an unsupported RepositoryElementInterface subtype whose type enum falls through the switch.","commonSituations":"Passing a custom RepositoryObject subclass; calling save() with elements like users/roles that must go through dedicated security APIs; version mismatches where new element types were added upstream but not to this adapter.","solutions":["Use the dedicated save method for the element type (e.g. saveJob, saveDatabaseMeta, saveCondition)","Verify the element's getRepositoryElementType() is a supported type before calling save()","If saving users/security elements, use the appropriate security service instead"],"exampleFix":"// before\nrepository.save(element, \"comment\", calendar, monitor); // element is a JobMeta\n// after\nrepository.saveJob((JobMeta) element, \"comment\", calendar, monitor);","handlingStrategy":"type-guard","validationCode":"RepositoryObjectType t = element.getRepositoryElementType();\nboolean supported = t == RepositoryObjectType.TRANSFORMATION || t == RepositoryObjectType.JOB\n  || t == RepositoryObjectType.DATABASE || t == RepositoryObjectType.CLUSTER_SCHEMA\n  || t == RepositoryObjectType.PARTITION_SCHEMA;","typeGuard":"boolean isSupportedElement(RepositoryElementInterface el) {\n  return el != null && el.getRepositoryElementType() != null && !el.getRepositoryElementType().isSecurity();\n}","tryCatchPattern":"try {\n  repository.save(element, comment, calendar, monitor);\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"not possible to save Class\")) {\n    log.error(\"Unsupported element type for generic save; use type-specific API\", e);\n  }\n}","preventionTips":["Use type-specific save methods (saveJob, saveTransformation, saveDatabaseMeta)","Never pass user/security elements to generic save()","Log element.getRepositoryElementType() when unsure"],"tags":["pentaho","kettle","unsupported-type","repository"],"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"}