pentaho/pentaho-kettle · error · KettleStepException
context.getMessage()
Error message
context.getMessage()
What it means
In PentahoReportingOutput.processReport, when the report export task reports a StatusType.ERROR status, the step deletes the partially written target file and rethrows the underlying cause if present, or throws a KettleStepException wrapping context.getMessage(). This surfaces the real render failure from the background export thread to the Kettle step lifecycle so the transformation step fails cleanly.
Solutions
- Inspect the step log above this message for the root cause from the export task; fix the underlying render/write error first
- Verify the target file/folder is writable and not locked by another process (open PDF viewers, editors)
- Check the report source file (prpt) path and the selected output processor type are valid
- If the message is too generic because no cause was attached, enable detailed step logging to capture the export task exception
Example fix
// before
throw new KettleStepException( context.getMessage() );
// after
Throwable cause = context.getCause();
if ( cause == null ) {
cause = new KettleStepException( context.getMessage() );
}
throw new KettleStepException( BaseMessages.getString( PKG,
"PentahoReportingOutput.Exception.UnexpectedErrorRenderingReport",
sourceFilename, targetFilename ), cause ); Defensive patterns
Strategy: try-catch
Validate before calling
// before running the step, ensure target is writable
FileObject target = KettleVFS.getInstance( bowl ).getFileObject( targetPath, transMeta );
if ( target.exists() && !target.delete() ) {
throw new KettleException( "Target locked/unremovable: " + targetPath );
} Type guard
boolean isErrorStatus(ExportStatus ctx) {
return ctx != null && ctx.getStatusType() == StatusType.ERROR;
} Try / catch
try {
processRow(...);
} catch ( KettleStepException e ) {
logError( "Report export failed: " + e.getMessage(), e ); // inspect cause chain
throw e;
} Prevention
- Keep detailed step logging enabled to capture the export task root cause
- Ensure the output directory exists and is writable by the Kettle user
- Avoid open file handles (PDF viewers) on target files during execution
- Validate report template and processor type in a pre-flight check
When it happens
Trigger: The ReportExportTask run() set status ERROR via the status listener (e.g. target file could not be deleted/created, parent folder missing, render exception) and either had no cause or the caller rethrows context.getMessage() as KettleStepException.
Common situations: Report rendering fails mid-export (bad report template, invalid output processor type, filesystem errors writing the target file); target file locked by another process so delete fails; export thread crashed without attaching a cause.
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
- AutoDoc.Exception.UnableToRenderReport
- AvroInputDialog.Error.KettleFileException
- Error during processing a row
- Exception reading line using NIO:
- Field could not be found in the input rows.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c0bbedfdb416cd44.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/PentahoReportingOutput.java:455
return new StreamReportProcessor( report, target );
}
};
break;
default:
exportTask = null;
break;
}
if ( exportTask != null ) {
exportTask.run();
}
if ( context.getStatusType() == StatusType.ERROR ) {
KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( targetFilename, getTransMeta() ).delete();
if ( context.getCause() != null ) {
throw context.getCause();
}
throw new KettleStepException( context.getMessage() );
}
ResultFile resultFile =
new ResultFile(
ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() )
.getFileObject( targetFilename, getTransMeta() ),
getTransMeta().getName(), getStepname() );
resultFile.setComment( "This file was created with a Pentaho Reporting Output step" );
addResultFile( resultFile );
} catch ( Throwable e ) {
throw new KettleException( BaseMessages.getString(
PKG, "PentahoReportingOutput.Exception.UnexpectedErrorRenderingReport", sourceFilename, targetFilename,
outputProcessorType.getDescription() ), e );
}
} finally {
//Restore the original class loader
Thread.currentThread().setContextClassLoader( old );View on GitHub (pinned to f3058517a1)