{"record":{"id":"465dbb2cab2d779f","repo":"pentaho/pentaho-kettle","slug":"stepwithmappingmeta-exception-unabletoloadtrans-465dbb","errorCode":"StepWithMappingMeta.Exception.UnableToLoadTrans","errorMessage":"StepWithMappingMeta.Exception.UnableToLoadTrans","messagePattern":"StepWithMappingMeta\\.Exception\\.UnableToLoadTrans","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectMeta.java","lineNumber":602,"sourceCode":"                throw new KettleException( \"Unable to load transformation [\" + realTransname + \"]\", e );\n              }\n            } else {\n              throw new KettleException( BaseMessages.getString( PKG,\n                \"MetaInjectMeta.Exception.UnableToLoadTransformationFromRepository\", realTransname, realDirectory ) );\n            }\n          }\n        } else {\n          try {\n            mappingTransMeta =\n              new TransMeta( bowl, realDirectory + \"/\" + realTransname, metaStore, rep, true, tmpSpace, null );\n          } catch ( KettleException ke ) {\n            try {\n              // add .ktr extension and try again\n              mappingTransMeta =\n                new TransMeta( bowl, realDirectory + \"/\" + realTransname + \".\" + Const.STRING_TRANS_DEFAULT_EXT,\n                  metaStore, rep, true, tmpSpace, null );\n            } catch ( KettleException ke2 ) {\n              throw new KettleException( BaseMessages.getString( PKG, \"StepWithMappingMeta.Exception.UnableToLoadTrans\",\n                realTransname ) + realDirectory );\n            }\n          }\n        }\n        break;\n      case REPOSITORY_BY_REFERENCE:\n        // Read the last revision by reference...\n        mappingTransMeta = rep.loadTransformation( injectMeta.getTransObjectId(), null );\n        break;\n      default:\n        break;\n    }\n\n    // Pass some important information to the mapping transformation metadata:\n    //\n    mappingTransMeta.copyVariablesFrom( space );\n    mappingTransMeta.setRepository( rep );\n    mappingTransMeta.setFilename( mappingTransMeta.getFilename() );","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/meta-inject/impl/src/main/java/org/pentaho/di/trans/steps/metainject/MetaInjectMeta.java#L584-L620","documentation":"Fallback path in the REPOSITORY_BY_NAME branch: after the direct repository load fails, MetaInjectMeta tries to load '<directory>/<transname>.ktr' as a file. If that KettleException also fails, it throws with localized StepWithMappingMeta.Exception.UnableToLoadTrans plus the directory, without a cause. Both load strategies have failed.","triggerScenarios":"loadTransformation where rep.loadTransformation threw and the secondary new TransMeta(realDirectory + \"/\" + realTransname + \".ktr\") also threw KettleException (file missing/corrupt).","commonSituations":"Transformation genuinely absent from both repository and filesystem; renaming the .ktr file extension or moving files out of the repo-mapped directory; corrupt transformation XML.","solutions":["Locate the transformation: confirm its actual repository path or file location.","Fix the directory/transName fields in the Meta Inject step dialog.","Validate the target .ktr opens standalone in Spoon.","Re-select the mapping transformation to reset the specification method cleanly."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Check both load targets before invoking the step\nboolean inRepo = rep.getTransformationID(realTransname, rep.getDirectoryID(realDirectory)) != null;\nboolean onDisk = new File(realDirectory + \"/\" + realTransname + \".ktr\").exists();\nif (!inRepo && !onDisk) throw new IllegalStateException(\"Transformation exists nowhere: \" + realTransname);","typeGuard":null,"tryCatchPattern":"try {\n  loadByName();\n} catch (KettleException e) {\n  try {\n    loadAsFile();\n  } catch (KettleException e2) {\n    logError(\"Neither repository nor file load worked for \" + realTransname, e2);\n  }\n}","preventionTips":["Keep repository and file copies in sync or use only one","Verify the target .ktr opens in Spoon","Re-select the mapping transformation after reorgs"],"tags":["repository","kettle","meta-inject","transformation-loading"],"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"}