{"record":{"id":"5061fa96be4a0606","repo":"pentaho/pentaho-kettle","slug":"arglist-0-is-not-a-file","errorCode":null,"errorMessage":"[ + ArgList[0] + ] is not a file!","messagePattern":"\\[ \\+ ArgList\\[0\\] \\+ \\] is not a file!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":2142,"sourceCode":"\n  public static boolean isFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n    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 {","sourceCodeStart":2124,"sourceCodeEnd":2160,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L2124-L2160","documentation":"Thrown by ScriptAddedFunctions.isFile when the resolved VFS object exists but is not a regular file (e.g. it is a directory). Instead of simply returning false, the implementation throws 'is not a file!' when the type check fails on an existing path.","triggerScenarios":"Calling isFile('/some/folder') where the path exists in VFS but has type FOLDER instead of FILE.","commonSituations":"Testing whether a path is a file but pointing at a directory, user-supplied paths that may be folders, or configuration variables containing directory roots.","solutions":["Pass a path you expect to be a regular file; handle directories before calling isFile.","Strip trailing '/' from directory paths and append the expected filename.","If you only need existence semantics, check existence separately and treat directories explicitly."],"exampleFix":"// before\n var ok = isFile('/data/archive');\n// after\n var ok = isFile('/data/archive/export.csv');","handlingStrategy":"validation","validationCode":"var f = new java.io.File(path);\nif (f.exists() && f.isFile()) {\n  var ok = isFile(path);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass paths expected to be regular files.","Strip trailing separators from directory-derived paths.","Treat isFile as throwing on directories, not returning false."],"tags":["kettle","javascript-step","vfs","not-a-file"],"backgroundTag":"invalid-argument-value","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"}