pentaho/pentaho-kettle · error · RuntimeException
Exporting jobs: Couldn't create file
Error message
Exporting jobs: Couldn't create file [${filename}] What it means
When exporting a job from the repository explorer, the XML is written with FileOutputStream. An IOException during file creation or writing is rethrown as RuntimeException 'Exporting jobs: Couldn't create file [filename]'. The target job export file could not be created.
Solutions
- Ensure the destination directory exists and is writable before exporting
- Use an absolute, variable-resolved path for the export filename
- Check disk space and file locks, then retry
- Read the wrapped IOException cause to identify the exact OS failure
Example fix
// before
exportJob("/mnt/ro-share/job.kjb");
// after
File out = new File(System.getProperty("user.home"), "job.kjb");
if (!out.getParentFile().canWrite()) { showError("Cannot write to " + out.getParent()); return; }
exportJob(out.getAbsolutePath()); Defensive patterns
Strategy: validation
Validate before calling
File f = new File(filename);
File parent = f.getParentFile();
if (parent == null || !parent.canWrite()) throw new IllegalStateException("Cannot write to " + parent); Try / catch
try { exportJob(filename); } catch (RuntimeException e) { if (e.getMessage().startsWith("Exporting jobs")) { showError("File creation failed for " + filename + ": " + e.getCause()); } else { throw e; } } Prevention
- Use absolute, already-resolved paths for job exports
- Verify disk space and write permissions before exporting
- Keep export destinations on local writable storage
- Check e.getCause() (IOException) to pinpoint the failure
When it happens
Trigger: Exporting a job to a path with a missing parent directory, no write permission, a directory already at that path, or a full disk.
Common situations: Export destination on a read-only or disconnected network share; unresolved ${filename} variable; filename with characters invalid on the OS; insufficient privileges of the PDI process.
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
- Exporting transformation: Couldn't create file
- ChangeFileEncoding.Error.CreatingFile
- ex.getMessage()
- GPLoadDataOutput.Exception" + e.getMessage()
- MailConnection.Error.SavingMessageContent
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/47535b898cde6181.
Report an issue: GitHub.
Appendix: source
Thrown at ui/src/main/java/org/pentaho/di/ui/repository/dialog/RepositoryExplorerDialog.java:2682
dir.mkdir();
log.logBasic( "Exporting Jobs", "Created directory [" + dir.getName() + "]" );
}
for ( int i = 0; i < jobs.length; i++ ) {
JobMeta ji = rep.loadJob( jobs[i], repdir, null, null ); // reads last version
log.logBasic( "Exporting Jobs", "[" + jobs[i] + "] in directory [" + repdir.getPath() + "]" );
String xml = XMLHandler.getXMLHeader() + ji.getXML();
String filename =
directory + repdir.getPath() + Const.FILE_SEPARATOR + fixFileName( jobs[i] ) + ".kjb";
File f = new File( filename );
try {
FileOutputStream fos = new FileOutputStream( f );
fos.write( xml.getBytes( Const.XML_ENCODING ) );
fos.close();
} catch ( IOException e ) {
throw new RuntimeException( "Exporting jobs: Couldn't create file [" + filename + "]", e );
}
}
}
}
} catch ( Exception e ) {
new ErrorDialog( shell,
BaseMessages.getString( PKG, "RepositoryExplorerDialog.ExportJobs.UnexpectedError.Title" ),
BaseMessages.getString( PKG, "RepositoryExplorerDialog.ExportJobs.UnexpectedError.Message" ), e );
}
}
public void exportAll( RepositoryDirectoryInterface dir ) {
FileDialog dialog = Spoon.getInstance().getExportFileDialog(); // new FileDialog( shell, SWT.SAVE | SWT.SINGLE );
if ( dialog.open() == null ) {
return;
}
String filename = dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName();View on GitHub (pinned to f3058517a1)