pentaho/pentaho-kettle · error · KettleJobException
' ' is not a directory
Error message
'<dirname>' is not a directory
What it means
DummyJob.getDir wraps a java.io.File for the given dirname and throws KettleJobException when File.isDirectory() returns false — i.e. the path does not exist or exists but is a regular file. It is a fail-fast argument validator used by srcDir before scanning a directory of files.
Solutions
- Print/resolve the actual dirname at runtime and verify it exists and is a directory (ls <dirname>).
- Fix the job entry configuration to use an absolute path or correct variable expression.
- If the path can legitimately be a file or missing, check new File(dirname).isDirectory() before calling and handle it.
- Ensure the path is valid on the node that executes the job (agents/cluster nodes may not share the same filesystem).
Example fix
// before
File dir = job.getDir( "/data/input" ); // throws if missing
// after
File f = new File( "/data/input" );
if ( !f.isDirectory() ) {
throw new KettleJobException( "Input directory missing: " + f.getAbsolutePath() );
}
File dir = job.getDir( f.getAbsolutePath() ); Defensive patterns
Strategy: validation
Validate before calling
// guard before calling getDir/srcDir
File f = new File( dirname );
if ( !f.exists() ) {
throw new IllegalArgumentException( "Directory does not exist: " + f.getAbsolutePath() );
}
if ( !f.isDirectory() ) {
throw new IllegalArgumentException( "Path is a file, not a directory: " + f.getAbsolutePath() );
} Try / catch
try {
File dir = job.getDir( dirname );
job.srcDir( dirname, outDir );
} catch ( KettleJobException e ) {
if ( e.getMessage() != null && e.getMessage().endsWith( "is not a directory" ) ) {
logError( "Check path config: " + e.getMessage() );
// skip or substitute a default directory
} else {
throw e;
}
} Prevention
- Use absolute paths in job entry configuration, or verified variable substitutions
- Validate directory existence on the executing node, not just the design machine
- Guard with new File(path).isDirectory() before invoking directory-scanning methods
- Watch for working-directory differences that break relative paths
When it happens
Trigger: Calling getDir (or srcDir, which calls it) with a dirname that is a file path, a typo'd/non-existent path, an empty string, or a path that exists relative to a different working directory than expected.
Common situations: Hard-coded job-entry directory settings pointing to a machine-local path that doesn't exist on the execution node; variable substitution (${Internal.Job.Filename.Directory}) resolving unexpectedly; path moved/renamed between job design and run; running the job from a different working directory so relative paths break.
Related errors
- Error opening new file
- ex.getMessage()
- GPG.ErrorCheckingGPGFile
- GPG.ErrorCreatingTempFile
- GPG.ErrorWritingTempFile
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/6bf59fd3b90d62b5.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/dummy/core/src/main/java/org/pentaho/di/pdi/jobentry/dummy/DummyJob.java:76
return false;
}
};
long files = 0;
File[] allFiles = srcDir.listFiles( regexFiler );
File outDir = new File( _targetDir );
outDir.mkdirs();
for ( int i = 0; i < allFiles.length; i++ ) {
File cFile = allFiles[i];
log.logDetailed( toString(), "processing file '" + cFile + "'" );
processFile( cFile, outDir );
}
return files;
}
public File getDir( String dirname ) throws KettleJobException {
File fl = new File( dirname );
if ( !fl.isDirectory() ) {
throw new KettleJobException( "'" + dirname + "' is not a directory" );
}
return fl;
}
public void processFile( File fl, File outDir ) throws FileNotFoundException {
// do something with the file here
}
}
View on GitHub (pinned to f3058517a1)