pentaho/pentaho-kettle · error · KettleException

LoadFileInput.Error.GettingFileContent

LoadFileInput.Error.GettingFileContent

Error message

LoadFileInput.Error.GettingFileContent

What it means

LoadFileInput.getFileBinaryContent reads the whole file as bytes via KettleVFS and wraps any failure in KettleException('Error getting file content' + filename + cause). It is thrown when the VFS stream cannot be opened or the read fails.

Solutions

  1. Read the chained cause message — it includes the filename and underlying exception.
  2. Verify the file exists and the path/URI scheme is valid at runtime.
  3. For remote files, test connectivity and refresh credentials.
  4. Re-try the transformation; if transient, add error handling / retry logic in the transformation.
  5. Check file permissions and that the file is not locked by another writer.

Example fix

// before
FileObject fo = KettleVFS.getInstance(bowl).getFileObject(path);
// after: pre-check before the step runs
FileObject fo = KettleVFS.getInstance(bowl).getFileObject(path);
if (fo == null || !fo.exists() || !fo.isReadable()) {
  throw new KettleException("File missing or unreadable: " + path);
}
Defensive patterns

Strategy: try-catch

Validate before calling

FileObject fo = KettleVFS.getInstance(bowl).getFileObject(path);
if (fo == null || !fo.exists() || !fo.isReadable()) {
  throw new KettleException("File not readable via VFS: " + path);
}

Try / catch

try {
  byte[] content = loadFileInput.getFileBinaryContent(bowl, path);
} catch (KettleException e) {
  log.error("Content read failed for " + path + ": " + e.getMessage(), e);
  // retry or skip
}

Prevention

When it happens

Trigger: KettleVFS.getInstance(bowl).getInputStream(vfsFilename) throws (file missing, invalid VFS URI scheme, auth failure) or IOUtils.toByteArray read fails mid-stream (IO error, connection drop for remote files).

Common situations: Typo in file path or unsupported VFS scheme; remote file (SFTP/S3/HTTP) unreachable or credentials expired; file locked by another process; empty/zero-byte network file causing stream failure.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInput.java:270

  }

  /**
   * Read a file.
   *
   * @param vfsFilename
   *          the filename or URL to read from
   * @return The content of the file as a byte[]
   * @throws KettleException
   */
  public static byte[] getFileBinaryContent( Bowl bowl, String vfsFilename ) throws KettleException {
    InputStream inputStream = null;

    byte[] retval = null;
    try {
      inputStream = KettleVFS.getInstance( bowl ).getInputStream( vfsFilename );
      retval = IOUtils.toByteArray( new BufferedInputStream( inputStream ) );
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "LoadFileInput.Error.GettingFileContent", vfsFilename, e.toString() ) );
    } finally {
      if ( inputStream != null ) {
        try {
          inputStream.close();
        } catch ( Exception e ) { /* Ignore */
        }
      }
    }

    return retval;
  }

  private void handleMissingFiles() throws KettleException {
    List<FileObject> nonExistantFiles = data.files.getNonExistantFiles();

    if ( !nonExistantFiles.isEmpty() ) {
      String message = FileInputList.getRequiredFilesDescription( nonExistantFiles );

View on GitHub (pinned to f3058517a1)