{"record":{"id":"424b12f6ac3c8ee9","repo":"pentaho/pentaho-kettle","slug":"trans-exception-unabletoloadtransformation","errorCode":null,"errorMessage":"Trans.Exception.UnableToLoadTransformation","messagePattern":"Trans\\.Exception\\.UnableToLoadTransformation","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/Trans.java","lineNumber":754,"sourceCode":"    this( bowl, parent, rep, name, dirname, filename, null);\n  }\n\n  @Deprecated\n  public <Parent extends VariableSpace & NamedParams> Trans( Parent parent, Repository rep, String name, String dirname,\n      String filename, TransMeta parentTransMeta ) throws KettleException {\n      this( DefaultBowl.getInstance(), parent, rep, name, dirname, filename, parentTransMeta );\n  }\n\n  public <Parent extends VariableSpace & NamedParams> Trans( Bowl bowl, Parent parent, Repository rep, String name,\n      String dirname, String filename, TransMeta parentTransMeta ) throws KettleException {\n    this();\n    try {\n      if ( rep != null ) {\n        RepositoryDirectoryInterface repdir = rep.findDirectory( dirname );\n        if ( repdir != null ) {\n          this.transMeta = rep.loadTransformation( name, repdir, null, false, null ); // reads last version\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"Trans.Exception.UnableToLoadTransformation\", name,\n            dirname ) );\n        }\n      } else {\n        transMeta = parentTransMeta != null ? parentTransMeta : new TransMeta( bowl, filename,\n          false );\n      }\n\n      this.log = new LogChannel( LogChannel.GENERAL_SUBJECT, false, false );\n      this.log.setHooks( this );\n\n      transMeta.initializeVariablesFrom( parent );\n      initializeVariablesFrom( parent );\n      // PDI-3064 do not erase parameters from meta!\n      // instead of this - copy parameters to actual transformation\n      this.copyParametersFrom( parent );\n      this.activateParameters();\n\n      this.setDefaultLogCommitSize();","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/Trans.java#L736-L772","documentation":"This Trans constructor loads the transformation metadata from a repository by name and directory, or from a filename. If the repository directory lookup fails (rep.findDirectory returns null), it throws this KettleException because the transformation cannot be loaded from the given location.","triggerScenarios":"new Trans(rep, name, dirname) where the directory does not exist in the repository; or the filename branch failing to construct a TransMeta.","commonSituations":"Hardcoded repository paths that don't exist after repository restructuring; wrong dirname variable value; migrating transformations between repositories; missing KTR file at the given filename.","solutions":["Verify the repository directory (dirname) exists and the transformation name is correct","Browse the repository in Spoon to find the actual directory path and update the caller","If loading by filename, confirm the file exists and is a valid KTR"],"exampleFix":"// before\nnew Trans(repository, \"myTrans\", \"/old/path\");\n// after\nnew Trans(repository, \"myTrans\", \"/prod/transforms\"); // existing directory","handlingStrategy":"try-catch","validationCode":"RepositoryDirectoryInterface dir = rep.findDirectory(dirname);\nif (dir == null || rep.exists(name, dir, RepositoryObjectType.TRANSFORMATION)) throw new IllegalStateException(\"Transformation not found: \" + dirname + \"/\" + name);","typeGuard":null,"tryCatchPattern":"try { Trans t = new Trans(rep, name, dirname); } catch (KettleException e) { log.error(\"Cannot load trans \" + name + \" from \" + dirname, e); }","preventionTips":["Verify repository directory paths in config before constructing Trans","Use directory discovery APIs rather than hardcoded paths","Synchronize repository directories across environments"],"tags":["kettle","repository","transformation-load"],"backgroundTag":"entity-not-found","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"}