pentaho/pentaho-kettle · error · RuntimeException

file to move [ + ArgList[0] + ] can not be found!

Error message

file to move [ + ArgList[0] + ] can not be found!

What it means

moveFile(source, destination, overwrite) is a scripting function that moves a file via KettleVFS. This RuntimeException is thrown when the resolved source FileObject does not exist at move time — the library refuses to proceed rather than silently fail, and the message interpolates the requested source path.

Solutions

  1. Verify the source path exists before calling: if (fileExists(src)) moveFile(src, dst, true)
  2. Check for typos, wrong working-directory assumptions, and correct VFS scheme prefix (file:///, sftp://...)
  3. Ensure no earlier transformation step already moved or deleted the source file
  4. Confirm case-sensitive spelling matches the actual filename on the filesystem

Example fix

// before
moveFile(srcPath, dstPath, true);
// after
if (fileExists(srcPath)) {
  moveFile(srcPath, dstPath, true);
} else {
  // handle missing source
}
Defensive patterns

Strategy: validation

Validate before calling

if (fileExists(srcPath)) {
  moveFile(srcPath, dstPath, true);
} else {
  Logger.logError('Source file missing: ' + srcPath);
}

Type guard

function sourceExists(p) { return p != null && typeof p === 'string' && p.length > 0 && fileExists(p); }

Try / catch

try {
  moveFile(src, dst, true);
} catch (e) {
  if (String(e.message).indexOf('can not be found') >= 0) {
    Logger.logError('Source missing: ' + src);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling moveFile('/path/missing.txt', '/dest/', ...) where the source file was never created, was already moved, was deleted by another process, or the path string has a typo/wrong protocol prefix.

Common situations: Absolute-vs-relative path confusion in the Kettle working directory; file consumed by an earlier step that moved/deleted it; NFS/network shares with transient availability; case-sensitivity mismatch on Linux; missing 'file:///' or 'sftp://' scheme so VFS resolves the wrong location.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/f27a6efb932e18c7. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2498

          // Destination filename
          fileDestination = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[1] );
          if ( fileSource.exists() ) {
            // Source file exists...
            if ( fileSource.getType() == FileType.FILE ) {
              // Great..source is a file ...
              boolean overwrite = false;
              if ( !ArgList[1].equals( null ) ) {
                overwrite = (Boolean) ArgList[2];
              }
              boolean destinationExists = fileDestination.exists();
              // Let's move the file...
              if ( ( destinationExists && overwrite ) || !destinationExists ) {
                fileSource.moveTo( fileDestination );
              }

            }
          } else {
            throw new RuntimeException( "file to move [" + ArgList[0] + "] can not be found!" );
          }
        } catch ( IOException e ) {
          throw new RuntimeException( "The function call moveFile throw an error : " + e.toString() );
        } finally {
          if ( fileSource != null ) {
            try {
              fileSource.close();
            } catch ( Exception e ) {
              // Ignore errors
            }
          }
          if ( fileDestination != null ) {
            try {
              fileDestination.close();
            } catch ( Exception e ) {
              // Ignore errors
            }
          }

View on GitHub (pinned to f3058517a1)