pentaho/pentaho-kettle · error · KettleException

JobMeta.Exception.AnErrorOccuredReadingJob

Error message

JobMeta.Exception.AnErrorOccuredReadingJob

What it means

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.

Solutions

  1. Verify every referenced sub-job/transformation file exists at the path recorded in the job entries
  2. Test the VFS URL scheme and credentials (e.g. open the file with KettleVFS before exporting)
  3. Read the chained FileSystemException for the exact file/protocol problem
  4. Fix relative paths (make them relative to the job file) or copy referenced files alongside the job

Example fix

// before
jobEntryJob.setFilename("subjobs/run.kjb"); // file actually at subjobs/run_job.kjb
// after
jobEntryJob.setFilename("${Internal.Job.Filename.Directory}/subjobs/run_job.kjb");
Defensive patterns

Strategy: validation

Validate before calling

// before export, verify every referenced file resolves through VFS
for (String ref : referencedFilenames) {
  org.apache.commons.vfs2.FileObject fo = org.pentaho.di.core.vfs.KettleVFS.getFileObject(ref);
  if (!fo.exists()) throw new IllegalStateException("Referenced file not found: " + ref);
}

Try / catch

try {
  jobMeta.exportResources(...);
} catch (KettleException e) {
  log.error("Resource export failed for job " + jobMeta.getFilename() + ": " + e.getCause(), e);
}

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/56248c8a9c21c872. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/JobMeta.java:2793

        // At the end, add ourselves to the map...
        //
        String jobMetaContent = jobMeta.getXML();

        definition = new ResourceDefinition( resourceName, jobMetaContent );

        // Also remember the original filename (if any), including variables etc.
        //
        if ( Utils.isEmpty( this.getFilename() ) ) { // Repository
          definition.setOrigin( fullname );
        } else {
          definition.setOrigin( this.getFilename() );
        }

        definitions.put( fullname, definition );
      }
    } catch ( FileSystemException e ) {
      throw new KettleException(
          BaseMessages.getString( PKG, "JobMeta.Exception.AnErrorOccuredReadingJob", getFilename() ), e );
    } catch ( KettleFileException e ) {
      throw new KettleException(
          BaseMessages.getString( PKG, "JobMeta.Exception.AnErrorOccuredReadingJob", getFilename() ), e );
    }

    return resourceName;
  }

  // calls deprecated APIs for old JobEntries that haven't updated
  @SuppressWarnings( "deprecation" )
  private void compatibleJobEntryExportResources( JobEntryInterface entry, JobMeta jobMeta,
      Map<String, ResourceDefinition> definitions, ResourceNamingInterface namingInterface, Repository repository2,
      IMetaStore metaStore ) throws KettleException {
    entry.exportResources( jobMeta, definitions, namingInterface, repository2 );
    entry.exportResources( jobMeta, definitions, namingInterface, repository2, metaStore );
  }

View on GitHub (pinned to f3058517a1)