pentaho/pentaho-kettle · error · KettleException
Unable to delete file with name [ + filename + ]
Error message
Unable to delete file with name [ + filename + ]
What it means
deleteFile() removes an arbitrary file from the file repository by absolute filename via VFS; any failure is wrapped in this KettleException naming the file. It is the low-level delete used by delObject and deletions of cluster schemas, partition schemas, and slaves.
Solutions
- Check the chained cause to distinguish missing-file vs permission/lock failures.
- Verify the repository base directory configuration — wrong base yields wrong computed filenames.
- Release file locks (close other Spoon instances / processes) and retry.
- Ensure delete permission on the repository directory for the running user.
Example fix
// before
deleteFile(filename); // throws if path wrong
// after: validate computed path against repo base first
if (!filename.startsWith(calcDirectoryName(null))) {
throw new IllegalArgumentException("Refusing delete outside repo: " + filename);
}
deleteFile(filename); Defensive patterns
Strategy: try-catch
Validate before calling
boolean insideRepo = filename.startsWith(calcDirectoryName(null)); boolean exists = new File(filename).exists();
Try / catch
try {
repo.deleteFile(filename);
} catch (KettleException e) {
if (e.getMessage().startsWith("Unable to delete file")) {
log.error("Delete failed for " + filename + ": " + e.getCause());
} else { throw e; }
} Prevention
- Verify the repository base directory is configured correctly
- Release Windows file locks (other Spoon instances) before deletes
- Guard against deleting paths outside the repo base
- Inspect the chained cause for missing-file vs permission issues
When it happens
Trigger: Any delete path that resolves to deleteFile(filename) where the FileObject cannot be resolved or deleted: nonexistent file, locked file, permission denied, invalid filename, or VFS provider errors.
Common situations: Deleting shared objects from a file repository whose files were moved externally; Windows file locks; wrong repository base directory configured so computed filenames don't exist; read-only mounts.
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
- Unable to delete database with name [ + name + ] and…
- Unable to save repository element [ + repositoryElement + ]…
- Cannot open control file
- Cannot open data file
- ChangeFileEncoding.Error.CreatingFile
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/8f8bf135eeaa7975.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java:459
}
public void deleteRootObject( String name, String extension ) throws KettleException {
try {
String filename = calcDirectoryName( null ) + name + extension;
FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );
fileObject.delete();
} catch ( Exception e ) {
throw new KettleException( "Unable to delete database with name ["
+ name + "] and extension [" + extension + "]", e );
}
}
public void deleteFile( String filename ) throws KettleException {
try {
FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename );
fileObject.delete();
} catch ( Exception e ) {
throw new KettleException( "Unable to delete file with name [" + filename + "]", e );
}
}
@Override
public ObjectId getClusterID( String name ) throws KettleException {
// The ID is the filename relative to the base directory, including the file extension
//
return new StringObjectId( calcObjectId( (RepositoryDirectory) null ) + name + EXT_SLAVE_SERVER );
}
@Override
public ObjectId[] getClusterIDs( boolean includeDeleted ) throws KettleException {
return getRootObjectIDs( EXT_CLUSTER_SCHEMA );
}
@Override
public String[] getClusterNames( boolean includeDeleted ) throws KettleException {
return convertRootIDsToNames( getClusterIDs( false ) );View on GitHub (pinned to f3058517a1)