{"record":{"id":"12973f3b640fd55a","repo":"pentaho/pentaho-kettle","slug":"jobtrans-exception-metadataload","errorCode":null,"errorMessage":"JobTrans.Exception.MetaDataLoad","messagePattern":"JobTrans\\.Exception\\.MetaDataLoad","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java","lineNumber":284,"sourceCode":"          }\n          break;\n        default:\n          throw new KettleException( \"The specified object location specification method '\"\n            + specificationMethod + \"' is not yet supported in this \" + friendlyMetaType + \" entry.\" );\n      }\n\n      cacheMeta( idContainer[ 0 ], theMeta );\n      // Re-seed the internal directory variables on the returned meta from the freshly resolved tmpSpace.\n      // The cache may return an instance whose internal vars were last set in a different context\n      // (e.g. from a step loader using getVarSpaceOnlyWithRequiredParentVars, or with rep==null),\n      // which would otherwise leak the wrong Internal.Entry.Current.Directory into the child execution.\n      reseedInternalDirectoryVars( theMeta, tmpSpace );\n      return theMeta;\n    } catch ( final KettleException ke ) {\n      // if we get a KettleException, simply re-throw it\n      throw ke;\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( persistentClass, \"JobTrans.Exception.MetaDataLoad\" ), e );\n    }\n  }\n\n  /**\n   * Force the four internal directory variables on the loaded meta to the values resolved by\n   * {@link CurrentDirectoryResolver} for *this* job-entry invocation. Without this, a cached\n   * TransMeta/JobMeta returned from a previous load can carry stale Internal.Entry.Current.Directory\n   * (and friends) inherited from whatever space was active during that earlier load.\n   */\n  private void reseedInternalDirectoryVars( T theMeta, VariableSpace tmpSpace ) {\n    if ( theMeta == null || tmpSpace == null || !( theMeta instanceof org.pentaho.di.base.AbstractMeta ) ) {\n      return;\n    }\n    org.pentaho.di.base.AbstractMeta meta = (org.pentaho.di.base.AbstractMeta) theMeta;\n    String entryDir = tmpSpace.getVariable( INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY );\n    if ( entryDir != null ) {\n      meta.setVariable( INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY, entryDir );\n    }","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java#L266-L302","documentation":"This is the catch-all wrapper at the end of getMetaForEntry: any non-KettleException thrown while resolving, loading, caching, or variable-reseeding the referenced meta (TransMeta/JobMeta) is wrapped in a KettleException whose message is the localized 'JobTrans.Exception.MetaDataLoad' (metadata load failure). The original exception is preserved as the cause. It signals that loading the child transformation/job metadata failed for an unexpected reason — I/O errors, parsing failures, repository errors, NPEs, etc.","triggerScenarios":"Any unexpected Exception inside getMetaForEntry: unreadable or malformed ktr/kjb file in FILENAME mode, repository load throwing a non-Kettle RuntimeException, errors in attemptLoadMeta/getMetaFromRepository, ClassCastException, or failures in reseedInternalDirectoryVars/cacheMeta.","commonSituations":"Referenced transformation file deleted or moved after the job was authored; corrupt or partially written ktr/kjb XML; missing VFS plugins (pvfs/hdfs) so file resolution throws; permission errors reading the file; repository connectivity flakiness surfacing as a raw exception.","solutions":["Inspect the wrapped cause (KettleException.getCause()) — it names the real failure (file not found, parse error, repo error).","Verify the referenced file path / repository object still exists and is readable; re-select the reference in Spoon and re-save the job.","Validate the ktr/kjb XML opens cleanly in Spoon; fix or regenerate corrupted metadata.","Ensure required VFS/connection plugins are installed and the process has filesystem permissions for the referenced path.","Wrap the call site in try/catch (KettleException ke) and log ke.getCause() for diagnostics before retrying or failing the parent job."],"exampleFix":"// before\ntheMeta = jobEntryLoader.getMetaForEntry( bowl, rep, metaStore, space ); // opaque MetaDataLoad failure\n\n// after\ntry {\n  theMeta = jobEntryLoader.getMetaForEntry( bowl, rep, metaStore, space );\n} catch ( KettleException ke ) {\n  logError( \"Loading job entry metadata failed: \" + ke.getMessage(), ke.getCause() );\n  throw ke;\n}","handlingStrategy":"try-catch","validationCode":"// pre-check the referenced artifact exists and is readable before loading\nString path = jobEntry.getFilename();\nif ( path != null && !new File( path ).canRead() ) {\n  throw new FileNotFoundException( \"Referenced metadata not readable: \" + path );\n}","typeGuard":"boolean metaLoadable( Repository rep, JobEntryInterface e, VariableSpace space ) {\n  switch ( e.getSpecificationMethod() ) {\n    case FILENAME: return e.getFilename() != null && new File( space.environmentSubstitute( e.getFilename() ) ).canRead();\n    case REPOSITORY_BY_REFERENCE: return rep != null && e.getObjectId() != null;\n    case REPOSITORY_BY_NAME: return rep != null && e.getName() != null;\n    default: return false;\n  }\n}","tryCatchPattern":"try {\n  meta = loader.getMetaForEntry( bowl, rep, metaStore, space );\n} catch ( KettleException ke ) {\n  Throwable cause = ke.getCause();\n  logError( \"Metadata load failed: \" + ke.getMessage() + \" caused by \" + cause, cause );\n  if ( cause instanceof FileNotFoundException || cause instanceof IOException ) {\n    throw new JobExecutionException( \"Referenced transformation/job file missing or unreadable\", ke );\n  }\n  throw ke;\n}","preventionTips":["Always inspect getCause() — this error is a wrapper and the root cause names the real problem.","Verify referenced ktr/kjb files exist at execution time (paths can move between environments).","Install required VFS plugins (pvfs/hdfs/s3) on every runtime node.","Open referenced metadata in Spoon periodically to catch corruption early.","Check filesystem permissions for the service account running Kitchen."],"tags":["kettle","metadata","file-read","job-entry","wrapped-exception"],"backgroundTag":"file-read-failed","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"}