pentaho/pentaho-kettle · error

The function call is File throw an error :

Error message

The function call is File throw an error : 

What it means

isFile() throws this when the file-type check raises a java.io.IOException; the java exception text is appended after the prefix. The path existed (the not-found branch reported it otherwise), but querying whether it is a regular file failed at the VFS layer.

Solutions

  1. Read the appended java exception text to identify the root cause.
  2. Check permissions and that the path is not a broken symlink.
  3. Prefer a plain local file:// path to test behavior.
  4. If the resource is remote, verify connectivity or cache the check result.
  5. Catch in JS and treat as 'unknown type' rather than failing the transform.

Example fix

// before
var ok = isFile(path);
// after
var ok;
try { ok = isFile(path); } catch (e) { ok = false; }
Defensive patterns

Strategy: try-catch

Validate before calling

var f = new java.io.File(path);
if (!f.exists()) { Logger.logBasic('path missing: ' + path); }

Try / catch

try { ok = isFile(path); } catch (e) { ok = false; Logger.logError('isFile failed: ' + e.message); }

Prevention

When it happens

Trigger: isFile('/path') on an existing resource where determining the type throws: permission issues, unresolvable symbolic link, network filesystem failure, or an exception while closing the FileObject in the finally block.

Common situations: Broken symlinks; stale NFS mounts; probing special VFS resources (archives, remote URLs) whose type detection requires I/O that fails.

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/f689a629eb30d450. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2238

        }
        FileObject file = null;

        try {
          // Source file
          file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) );
          boolean isafile = false;
          if ( file.exists() ) {
            if ( file.getType().equals( FileType.FILE ) ) {
              isafile = true;
            } else {
              Context.reportRuntimeError( "[" + Context.toString( ArgList[0] ) + "] is not a file!" );
            }
          } else {
            Context.reportRuntimeError( "file [" + Context.toString( ArgList[0] ) + "] can not be found!" );
          }
          return isafile;
        } catch ( IOException e ) {
          throw Context.reportRuntimeError( "The function call is File throw an error : " + e.toString() );
        } finally {
          if ( file != null ) {
            try {
              file.close();
            } catch ( Exception e ) {
              // Ignore errors
            }
          }
        }

      } else {
        throw Context.reportRuntimeError( "The function call isFile is not valid." );
      }
    } catch ( Exception e ) {
      throw Context.reportRuntimeError( e.toString() );
    }
  }

View on GitHub (pinned to f3058517a1)