{"record":{"id":"c0bbedfdb416cd44","repo":"pentaho/pentaho-kettle","slug":"context-getmessage","errorCode":null,"errorMessage":"context.getMessage()","messagePattern":"context\\.getMessage\\(\\)","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/PentahoReportingOutput.java","lineNumber":455,"sourceCode":"                return new StreamReportProcessor( report, target );\n              }\n            };\n            break;\n          default:\n            exportTask = null;\n            break;\n        }\n\n        if ( exportTask != null ) {\n          exportTask.run();\n        }\n\n        if ( context.getStatusType() == StatusType.ERROR ) {\n          KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( targetFilename, getTransMeta() ).delete();\n          if ( context.getCause() != null ) {\n            throw context.getCause();\n          }\n          throw new KettleStepException( context.getMessage() );\n        }\n\n        ResultFile resultFile =\n          new ResultFile(\n            ResultFile.FILE_TYPE_GENERAL, KettleVFS.getInstance( getTransMeta().getBowl() )\n            .getFileObject( targetFilename, getTransMeta() ),\n            getTransMeta().getName(), getStepname() );\n        resultFile.setComment( \"This file was created with a Pentaho Reporting Output step\" );\n        addResultFile( resultFile );\n\n      } catch ( Throwable e ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"PentahoReportingOutput.Exception.UnexpectedErrorRenderingReport\", sourceFilename, targetFilename,\n          outputProcessorType.getDescription() ), e );\n      }\n    } finally {\n      //Restore the original class loader\n      Thread.currentThread().setContextClassLoader( old );","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/PentahoReportingOutput.java#L437-L473","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nthrow new KettleStepException( context.getMessage() );\n// after\nThrowable cause = context.getCause();\nif ( cause == null ) {\n  cause = new KettleStepException( context.getMessage() );\n}\nthrow new KettleStepException( BaseMessages.getString( PKG,\n  \"PentahoReportingOutput.Exception.UnexpectedErrorRenderingReport\",\n  sourceFilename, targetFilename ), cause );","handlingStrategy":"try-catch","validationCode":"// before running the step, ensure target is writable\nFileObject target = KettleVFS.getInstance( bowl ).getFileObject( targetPath, transMeta );\nif ( target.exists() && !target.delete() ) {\n  throw new KettleException( \"Target locked/unremovable: \" + targetPath );\n}","typeGuard":"boolean isErrorStatus(ExportStatus ctx) {\n  return ctx != null && ctx.getStatusType() == StatusType.ERROR;\n}","tryCatchPattern":"try {\n  processRow(...);\n} catch ( KettleStepException e ) {\n  logError( \"Report export failed: \" + e.getMessage(), e ); // inspect cause chain\n  throw e;\n}","preventionTips":["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"],"tags":["kettle","reporting","file-io"],"backgroundTag":"file-write-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}