{"record":{"id":"a4bf717c3e27003b","repo":"pentaho/pentaho-kettle","slug":"jobentrybase-must-be-a-jobentrytrans-or-jobentryjob-object","errorCode":null,"errorMessage":"JobEntryBase must be a JobEntryTrans or JobEntryJob object","messagePattern":"JobEntryBase must be a JobEntryTrans or JobEntryJob object","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java","lineNumber":108,"sourceCode":"      this.filename = jobEntryBase.getFilename();\n      //collect fields from the super classes\n      if ( jobEntryBase instanceof JobEntryTrans ) {\n        JobEntryTrans jobEntryTrans = (JobEntryTrans) jobEntryBase;\n        this.metaName = jobEntryTrans.getTransname();\n        this.directory = jobEntryTrans.getDirectory();\n        this.metaObjectId = jobEntryTrans.getTransObjectId();\n        this.friendlyMetaType = \"Transformation\";\n        this.persistentClass = TransMeta.class;\n      } else {\n        JobEntryJob jobEntryJob = (JobEntryJob) jobEntryBase;\n        this.metaName = jobEntryJob.getJobName();\n        this.directory = jobEntryJob.getDirectory();\n        this.metaObjectId = jobEntryJob.getJobObjectId();\n        this.friendlyMetaType = \"Job\";\n        this.persistentClass = JobMeta.class;\n      }\n    } else {\n      throw new IllegalArgumentException( \"JobEntryBase must be a JobEntryTrans or JobEntryJob object\" );\n    }\n    useCache = \"Y\".equalsIgnoreCase( System.getProperty( Const.KETTLE_USE_META_FILE_CACHE, Const.KETTLE_USE_META_FILE_CACHE_DEFAULT ) );\n  }\n\n  /**\n   * @param baseStepMeta        either a StepWithMappingMeta or JobExecutorMeta Object (BaseStepMeta is a shared\n   *                            subclass )\n   * @param specificationMethod\n   */\n  public MetaFileLoaderImpl( BaseStepMeta baseStepMeta, ObjectLocationSpecificationMethod specificationMethod ) {\n    //Constructor adapting supported Steps\n    if ( baseStepMeta instanceof StepWithMappingMeta || baseStepMeta instanceof JobExecutorMeta ) {\n      this.baseStepMeta = baseStepMeta;\n      this.specificationMethod = specificationMethod;\n      //collect fields from the super classes\n      if ( baseStepMeta instanceof StepWithMappingMeta ) {\n        StepWithMappingMeta stepWithMappingMeta = (StepWithMappingMeta) baseStepMeta;\n        this.metaName = stepWithMappingMeta.getTransName();","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/base/MetaFileLoaderImpl.java#L90-L126","documentation":"The MetaFileLoaderImpl constructor accepts a JobEntryBase that must be either a JobEntryTrans (mapping to TransMeta) or a JobEntryJob (mapping to JobMeta). Any other JobEntryBase subtype reaches the else branch and throws IllegalArgumentException 'JobEntryBase must be a JobEntryTrans or JobEntryJob object'.","triggerScenarios":"Constructing MetaFileLoaderImpl with a job entry that is neither JobEntryTrans nor JobEntryJob — e.g. a custom job entry, or passing a step meta object into the job-entry constructor variant.","commonSituations":"Custom plugins or mapping-executor code that builds a MetaFileLoader for arbitrary job entries; refactors that changed which entry type is passed; generic code iterating job entries and assuming all are Trans/Job entries.","solutions":["Ensure only JobEntryTrans or JobEntryJob instances are passed to this constructor; filter or branch on instanceof before constructing.","Use the step-meta constructor variant (BaseStepMeta / StepWithMappingMeta / JobExecutorMeta) for step-level entries instead.","Inspect the object's actual class in the log and route it to the appropriate loader.","If a custom entry needs file-based loading, extend MetaFileLoader rather than reusing this constructor."],"exampleFix":"// before\nMetaFileLoaderImpl loader = new MetaFileLoaderImpl( someJobEntry, ... ); // throws for other entry types\n// after\nif ( someJobEntry instanceof JobEntryTrans || someJobEntry instanceof JobEntryJob ) {\n  MetaFileLoaderImpl loader = new MetaFileLoaderImpl( someJobEntry, ... );\n}","handlingStrategy":"type-guard","validationCode":"if ( !( entry instanceof JobEntryTrans ) && !( entry instanceof JobEntryJob ) ) {\n  throw new IllegalArgumentException( \"Unsupported entry type: \" + entry.getClass().getName() );\n}","typeGuard":"boolean isFileLoaderCompatible( JobEntryBase entry ) {\n  return entry instanceof JobEntryTrans || entry instanceof JobEntryJob;\n}","tryCatchPattern":"try {\n  MetaFileLoaderImpl l = new MetaFileLoaderImpl( entry, ... );\n} catch ( IllegalArgumentException e ) {\n  log.error( \"Entry not supported by MetaFileLoaderImpl: \" + entry.getClass().getName() );\n}","preventionTips":["Filter job entries to Trans/Job types before executor/mapping logic","Use instanceof branches for custom job entries","Write tests covering each JobEntryBase subtype routed to this constructor"],"tags":["invalid-argument-value","job-entry","java","engine"],"backgroundTag":"invalid-argument-value","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"}