{"record":{"id":"8ae254090b51b3bc","repo":"pentaho/pentaho-kettle","slug":"pantransformationdelegate-error-transmetanull","errorCode":null,"errorMessage":"PanTransformationDelegate.Error.TransMetaNull","messagePattern":"PanTransformationDelegate\\.Error\\.TransMetaNull","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/pan/delegates/PanTransformationDelegate.java","lineNumber":89,"sourceCode":"    this.transformationExecutorServiceMap = map;\n  }\n\n  /**\n   * Execute a transformation with the specified configuration.\n   *\n   * @param trans              the transformation\n   * @param executionConfiguration the execution configuration\n   * @param arguments              command line arguments\n   * @return the execution result\n   * @throws KettleException if execution fails\n   */\n  public Result executeTransformation( final Trans trans,\n                                       final TransExecutionConfiguration executionConfiguration,\n                                       final String[] arguments ) throws KettleException {\n\n    TransMeta transMeta = trans.getTransMeta();\n    if ( transMeta == null ) {\n      throw new KettleException( BaseMessages.getString( pkg, \"PanTransformationDelegate.Error.TransMetaNull\" ) );\n    }\n\n    // Set repository and metastore information in both the exec config and the metadata\n    transMeta.setRepository( repository );\n    transMeta.setMetaStore( MetaStoreConst.getDefaultMetastore() );\n    executionConfiguration.setRepository( repository );\n\n    // Set the run options\n    transMeta.setClearingLog( executionConfiguration.isClearingLog() );\n    transMeta.setSafeModeEnabled( executionConfiguration.isSafeModeEnabled() );\n    transMeta.setGatheringMetrics( executionConfiguration.isGatheringMetrics() );\n\n    // Call extension points\n    ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransMetaExecutionStart.id, transMeta );\n    ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransExecutionConfiguration.id, executionConfiguration );\n\n    try {\n      ExtensionPointHandler.callExtensionPoint( log, KettleExtensionPoint.SpoonTransBeforeStart.id, new Object[] {","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/pan/delegates/PanTransformationDelegate.java#L71-L107","documentation":"PanTransformationDelegate.executeTransformation throws KettleException when trans.getTransMeta() returns null, meaning the transformation metadata backing the Trans object is missing. This is a defensive check before configuration is applied to the transformation.","triggerScenarios":"Calling executeTransformation with a Trans instance constructed without TransMeta, or whose TransMeta was never loaded/assigned.","commonSituations":"Programmatic use of Pan delegates with a partially built Trans; test harnesses constructing Trans() with the no-arg constructor; failed load path that swallowed a load exception but still returned a Trans.","solutions":["Construct the Trans with a loaded TransMeta: new Trans(new TransMeta(file, repository))","Ensure the TransMeta load call succeeded before creating Trans","Check that the transformation file path is valid and parseable"],"exampleFix":"// before\nTrans trans = new Trans();\ndelegate.executeTransformation(trans, config, args);\n// after\nTransMeta transMeta = new TransMeta(\"trans.ktr\", repository);\nTrans trans = new Trans(transMeta);\ndelegate.executeTransformation(trans, config, args);","handlingStrategy":"type-guard","validationCode":"if (trans == null || trans.getTransMeta() == null) {\n  throw new IllegalArgumentException(\"Trans must be constructed with a loaded TransMeta\");\n}","typeGuard":"static boolean hasTransMeta(Trans trans) {\n  return trans != null && trans.getTransMeta() != null;\n}","tryCatchPattern":"try {\n  delegate.executeTransformation(trans, config, args);\n} catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().endsWith(\"TransMetaNull\")) {\n    throw new IllegalStateException(\"Pass new Trans(new TransMeta(...)) — TransMeta was null\", e);\n  }\n  throw e;\n}","preventionTips":["Always construct Trans with a loaded TransMeta","Check TransMeta load return/exceptions before wrapping in Trans","Use TransMeta.isPackageable/exists checks in factories","Avoid Trans no-arg constructor in production code"],"tags":["pan","transmeta","null-check"],"backgroundTag":"null-argument","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"}