{"record":{"id":"56248c8a9c21c872","repo":"pentaho/pentaho-kettle","slug":"jobmeta-exception-anerroroccuredreadingjob","errorCode":null,"errorMessage":"JobMeta.Exception.AnErrorOccuredReadingJob","messagePattern":"JobMeta\\.Exception\\.AnErrorOccuredReadingJob","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/JobMeta.java","lineNumber":2793,"sourceCode":"\n        // At the end, add ourselves to the map...\n        //\n        String jobMetaContent = jobMeta.getXML();\n\n        definition = new ResourceDefinition( resourceName, jobMetaContent );\n\n        // Also remember the original filename (if any), including variables etc.\n        //\n        if ( Utils.isEmpty( this.getFilename() ) ) { // Repository\n          definition.setOrigin( fullname );\n        } else {\n          definition.setOrigin( this.getFilename() );\n        }\n\n        definitions.put( fullname, definition );\n      }\n    } catch ( FileSystemException e ) {\n      throw new KettleException(\n          BaseMessages.getString( PKG, \"JobMeta.Exception.AnErrorOccuredReadingJob\", getFilename() ), e );\n    } catch ( KettleFileException e ) {\n      throw new KettleException(\n          BaseMessages.getString( PKG, \"JobMeta.Exception.AnErrorOccuredReadingJob\", getFilename() ), e );\n    }\n\n    return resourceName;\n  }\n\n  // calls deprecated APIs for old JobEntries that haven't updated\n  @SuppressWarnings( \"deprecation\" )\n  private void compatibleJobEntryExportResources( JobEntryInterface entry, JobMeta jobMeta,\n      Map<String, ResourceDefinition> definitions, ResourceNamingInterface namingInterface, Repository repository2,\n      IMetaStore metaStore ) throws KettleException {\n    entry.exportResources( jobMeta, definitions, namingInterface, repository2 );\n    entry.exportResources( jobMeta, definitions, namingInterface, repository2, metaStore );\n  }\n","sourceCodeStart":2775,"sourceCodeEnd":2811,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/JobMeta.java#L2775-L2811","documentation":"JobMeta's resource-reference export logic throws this KettleException when an org.apache.commons.vfs2.FileSystemException occurs while reading a referenced job/resource file through VFS while exporting job definitions. It wraps the VFS error with a message naming the job filename.","triggerScenarios":"During exportResource / resource export, JobMeta traverses referenced sub-jobs and transformations via VFS; a referenced file path is invalid, unreachable, or the VFS provider fails, throwing FileSystemException which is wrapped with 'JobMeta.Exception.AnErrorOccuredReadingJob'.","commonSituations":"A sub-job referenced by relative path does not exist at export time; VFS URL with unsupported scheme (sftp/ smb) unavailable or misconfigured; network drive disconnected; filename with special characters breaking the VFS resolution.","solutions":["Verify every referenced sub-job/transformation file exists at the path recorded in the job entries","Test the VFS URL scheme and credentials (e.g. open the file with KettleVFS before exporting)","Read the chained FileSystemException for the exact file/protocol problem","Fix relative paths (make them relative to the job file) or copy referenced files alongside the job"],"exampleFix":"// before\njobEntryJob.setFilename(\"subjobs/run.kjb\"); // file actually at subjobs/run_job.kjb\n// after\njobEntryJob.setFilename(\"${Internal.Job.Filename.Directory}/subjobs/run_job.kjb\");","handlingStrategy":"validation","validationCode":"// before export, verify every referenced file resolves through VFS\nfor (String ref : referencedFilenames) {\n  org.apache.commons.vfs2.FileObject fo = org.pentaho.di.core.vfs.KettleVFS.getFileObject(ref);\n  if (!fo.exists()) throw new IllegalStateException(\"Referenced file not found: \" + ref);\n}","typeGuard":null,"tryCatchPattern":"try {\n  jobMeta.exportResources(...);\n} catch (KettleException e) {\n  log.error(\"Resource export failed for job \" + jobMeta.getFilename() + \": \" + e.getCause(), e);\n}","preventionTips":["Use ${Internal.Job.Filename.Directory} relative paths for sub-jobs","Keep referenced jobs on reachable mounts; test VFS URLs/credentials beforehand","Dry-run: open every sub-job in Spoon before exporting resources"],"tags":["vfs","job-meta","file-io","kettle"],"backgroundTag":"file-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"}