pentaho/pentaho-kettle · error
The function call copyFile throw an error :
Error message
The function call copyFile throw an error :
What it means
copyFile() throws this when the copy operation raises a java.io.IOException; the exception text is appended after the prefix. It means the source file was found but reading it or writing the destination failed. The message includes the underlying java.io exception, which is the key diagnostic.
Solutions
- Read the appended java exception text to pinpoint the failing side (source read vs destination write).
- Verify the destination directory exists and is writable.
- Ensure the destination path is a file path, not an existing directory.
- Check free disk space and that neither file is locked by another process.
- Ensure both src and dst are proper string paths/URIs.
Example fix
// before
copyFile('/data/in.csv', '/data/backup'); // backup is a directory
// after
copyFile('/data/in.csv', '/data/backup/in.csv'); Defensive patterns
Strategy: validation
Validate before calling
var srcF = new java.io.File(src);
var dstF = new java.io.File(dst);
if (!srcF.exists()) { throw new Error('src missing: ' + src); }
if (dstF.isDirectory()) { throw new Error('dst is a directory: ' + dst); }
var parent = dstF.getParentFile();
if (parent != null && !parent.exists()) { parent.mkdirs(); } Try / catch
try { copyFile(src, dst); } catch (e) { Logger.logError('copy failed: ' + e.message); } Prevention
- Ensure destination parent exists and is writable
- Destination must be a file path, not a directory
- Check disk space before large copies
- Read the appended java exception text to find the failing side
When it happens
Trigger: copyFile(src, dst) with an existing src but: destination is a directory or unwritable, destination parent missing, disk full, file locked, or VFS cannot open one of the two FileObjects.
Common situations: Copying onto a path that already exists as a directory; target volume full; network share dropped mid-copy; permission denied on the destination folder.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- The function call copyFileis not valid.
- The function call createFolder is not valid.
- The function call getFileSize throw an error :
- The function call is File throw an error :
- JsonOutput.Error.Writing
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/2378cfc73087eff6.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2145
// Source file exists...
if ( fileSource.getType() == FileType.FILE ) {
// Great..source is a file ...
boolean overwrite = false;
if ( !ArgList[1].equals( null ) ) {
overwrite = Context.toBoolean( ArgList[2] );
}
boolean destinationExists = fileDestination.exists();
// Let's copy the file...
if ( ( destinationExists && overwrite ) || !destinationExists ) {
FileUtil.copyContent( fileSource, fileDestination );
}
}
} else {
Context.reportRuntimeError( "file to copy [" + Context.toString( ArgList[0] ) + "] can not be found!" );
}
} catch ( IOException e ) {
throw Context.reportRuntimeError( "The function call copyFile 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
}
}
}
} else {View on GitHub (pinned to f3058517a1)