{"record":{"id":"1b54dd1402479313","repo":"pentaho/pentaho-kettle","slug":"loadfileinput-error-gettingfilecontent","errorCode":"LoadFileInput.Error.GettingFileContent","errorMessage":"LoadFileInput.Error.GettingFileContent","messagePattern":"LoadFileInput\\.Error\\.GettingFileContent","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInput.java","lineNumber":270,"sourceCode":"  }\n\n  /**\n   * Read a file.\n   *\n   * @param vfsFilename\n   *          the filename or URL to read from\n   * @return The content of the file as a byte[]\n   * @throws KettleException\n   */\n  public static byte[] getFileBinaryContent( Bowl bowl, String vfsFilename ) throws KettleException {\n    InputStream inputStream = null;\n\n    byte[] retval = null;\n    try {\n      inputStream = KettleVFS.getInstance( bowl ).getInputStream( vfsFilename );\n      retval = IOUtils.toByteArray( new BufferedInputStream( inputStream ) );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"LoadFileInput.Error.GettingFileContent\", vfsFilename, e.toString() ) );\n    } finally {\n      if ( inputStream != null ) {\n        try {\n          inputStream.close();\n        } catch ( Exception e ) { /* Ignore */\n        }\n      }\n    }\n\n    return retval;\n  }\n\n  private void handleMissingFiles() throws KettleException {\n    List<FileObject> nonExistantFiles = data.files.getNonExistantFiles();\n\n    if ( !nonExistantFiles.isEmpty() ) {\n      String message = FileInputList.getRequiredFilesDescription( nonExistantFiles );","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInput.java#L252-L288","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the chained cause message — it includes the filename and underlying exception.","Verify the file exists and the path/URI scheme is valid at runtime.","For remote files, test connectivity and refresh credentials.","Re-try the transformation; if transient, add error handling / retry logic in the transformation.","Check file permissions and that the file is not locked by another writer."],"exampleFix":"// before\nFileObject fo = KettleVFS.getInstance(bowl).getFileObject(path);\n// after: pre-check before the step runs\nFileObject fo = KettleVFS.getInstance(bowl).getFileObject(path);\nif (fo == null || !fo.exists() || !fo.isReadable()) {\n  throw new KettleException(\"File missing or unreadable: \" + path);\n}","handlingStrategy":"try-catch","validationCode":"FileObject fo = KettleVFS.getInstance(bowl).getFileObject(path);\nif (fo == null || !fo.exists() || !fo.isReadable()) {\n  throw new KettleException(\"File not readable via VFS: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  byte[] content = loadFileInput.getFileBinaryContent(bowl, path);\n} catch (KettleException e) {\n  log.error(\"Content read failed for \" + path + \": \" + e.getMessage(), e);\n  // retry or skip\n}","preventionTips":["Verify paths and VFS schemes before running","Refresh remote credentials/tokens","Check file locks and permissions","Retry transient remote read failures"],"tags":["kettle","pentaho","file-io","vfs","load-file"],"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"}