{"record":{"id":"da7103a121ba91bc","repo":"pentaho/pentaho-kettle","slug":"file-arglist-0-can-not-be-found","errorCode":null,"errorMessage":"file [ + ArgList[0] + ] can not be found!","messagePattern":"file \\[ \\+ ArgList\\[0\\] \\+ \\] can not be found!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":2145,"sourceCode":"    try {\n      if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) {\n        if ( ArgList[0].equals( null ) ) {\n          return false;\n        }\n        FileObject file = null;\n\n        try {\n          // Source file\n          file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );\n          boolean isafile = false;\n          if ( file.exists() ) {\n            if ( file.getType().equals( FileType.FILE ) ) {\n              isafile = true;\n            } else {\n              throw new RuntimeException( \"[\" + ArgList[0] + \"] is not a file!\" );\n            }\n          } else {\n            throw new RuntimeException( \"file [\" + ArgList[0] + \"] can not be found!\" );\n          }\n          return isafile;\n        } catch ( IOException e ) {\n          throw new RuntimeException( \"The function call is File throw an error : \" + e.toString() );\n        } finally {\n          if ( file != null ) {\n            try {\n              file.close();\n            } catch ( Exception e ) {\n              // Ignore errors\n            }\n          }\n        }\n\n      } else {\n        throw new RuntimeException( \"The function call isFile is not valid.\" );\n      }\n    } catch ( Exception e ) {","sourceCodeStart":2127,"sourceCodeEnd":2163,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L2127-L2163","documentation":"Misreported-looking guard from the isFile/file-exists family in the script step: the file named by ArgList[0] could not be resolved through KettleVFS (does not exist or is unreachable), so the existence check fails and the runtime error reports the missing file path.","triggerScenarios":"Calling isFile('/missing/path.txt') where KettleVFS resolves the object but file.exists() is false: wrong path, file not yet created, deleted between steps, or wrong working directory for relative paths.","commonSituations":"Checking for optional input files that were never produced, environment-dependent absolute paths, and relative paths resolved against the Spoon vs. Pan working directory.","solutions":["Verify the exact path exists before the transformation step (ls / log the resolved path).","Use absolute paths or set the correct base directory for relative paths.","Ensure any step that generates the file completes successfully before isFile runs.","Check VFS scheme/credentials if the file lives on a remote filesystem."],"exampleFix":"// before\n var ok = isFile('/staging/dump.csv'); // never created\n// after\n var ok = isFile('/staging/output/dump.csv'); // correct output dir","handlingStrategy":"validation","validationCode":"var f = new java.io.File(path);\nif (f.exists()) {\n  var ok = isFile(path);\n} else {\n  // file absent — decide policy here instead of letting isFile throw\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check existence with java.io.File before calling isFile.","Use absolute paths; confirm the working directory of the execution engine (Spoon vs Pan).","Guarantee producing steps finished before existence checks."],"tags":["kettle","javascript-step","vfs","file-not-found"],"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"}