pentaho/pentaho-kettle · error

The function call getShortFilename throw an error :

Error message

The function call getShortFilename throw an error : 

What it means

getShortFilename() returns the base name (filename without directory) of the file identified by its single argument, using KettleVFS. If a java.io.IOException is thrown while resolving the VFS file object or reading its name, the function converts it to a JavaScript runtime error: 'The function call getShortFilename throw an error : ' followed by the exception text.

Solutions

  1. Validate/normalize the path as a proper VFS URI before calling
  2. Confirm the filesystem is reachable and the scheme is supported
  3. Test the path with file.exists()-style checks (isFile) first
  4. Update commons-vfs and provider dependencies if the scheme is valid

Example fix

// before
var name = getShortFilename('sftps://host/dir/file.txt'); // wrong scheme
// after
var name = getShortFilename('sftp://host/dir/file.txt');
Defensive patterns

Strategy: try-catch

Validate before calling

var f = isFile(path); // existence/I-O errors surface here first

Type guard

function isValidPath(v) { return typeof v === 'string' && v.length > 0 && !/\s{2,}/.test(v); }

Try / catch

try { var n = getShortFilename(path); } catch (e) {
  n = null; // IOException from VFS — handle unavailable file
}

Prevention

When it happens

Trigger: KettleVFS.getFileObject() or file.getName() throwing IOException — malformed VFS URI, unsupported scheme/provider, unreachable remote filesystem, or I/O failure during resolution/close.

Common situations: Remote SFTP/S3 paths when the network is down, paths with unescaped spaces or special characters, missing VFS provider for the URI scheme, VFS library version mismatch.

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

Appendix: source

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

        if ( ArgList[0].equals( null ) ) {
          return null;
        }
        FileObject file = null;

        try {
          // Source file
          file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) );
          String Filename = null;
          if ( file.exists() ) {
            Filename = file.getName().getBaseName().toString();

          } else {
            Context.reportRuntimeError( "file [" + Context.toString( ArgList[0] ) + "] can not be found!" );
          }

          return Filename;
        } catch ( IOException e ) {
          throw Context.reportRuntimeError( "The function call getShortFilename throw an error : " + e.toString() );
        } finally {
          if ( file != null ) {
            try {
              file.close();
            } catch ( Exception e ) {
              // Ignore errors
            }
          }
        }

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

View on GitHub (pinned to f3058517a1)