{"record":{"id":"5bb7fd704fe36eb5","repo":"pentaho/pentaho-kettle","slug":"gploaddataoutput-exception-e-getmessage","errorCode":null,"errorMessage":"GPLoadDataOutput.Exception\" + e.getMessage()","messagePattern":"GPLoadDataOutput\\.Exception\" \\+ e\\.getMessage\\(\\)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadDataOutput.java","lineNumber":107,"sourceCode":"      dataFile = space.environmentSubstitute( dataFile );\n      if ( Utils.isEmpty( dataFile ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"GPload.Exception.DataFileMissing\" ) );\n      }\n\n      log.logDetailed( \"Creating temporary load file \" + dataFile );\n      os = new FileOutputStream( dataFile, false );\n      //\n\n      String encoding = meta.getEncoding();\n      if ( Utils.isEmpty( encoding ) ) {\n        // Use the default encoding.\n        output = new PrintWriter( new BufferedWriter( new OutputStreamWriter( os ) ) );\n      } else {\n        // Use the specified encoding\n        output = new PrintWriter( new BufferedWriter( new OutputStreamWriter( os, encoding ) ) );\n      }\n    } catch ( IOException e ) {\n      throw new KettleException( \"GPLoadDataOutput.Exception\" + e.getMessage(), e );\n    }\n  }\n\n  public void close() throws IOException {\n    if ( output != null ) {\n      output.close();\n    }\n  }\n\n  PrintWriter getOutput() {\n    return output;\n  }\n\n  protected void setOutput( PrintWriter output ) {\n    this.output = output;\n  }\n\n  private String createEscapedString( String orig, String enclosure ) {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadDataOutput.java#L89-L125","documentation":"open() wraps stream construction (FileOutputStream, OutputStreamWriter, PrintWriter) in a try/catch and rethrows any IOException as a KettleException with prefix 'GPLoadDataOutput.Exception'. This means the data file could not be opened/written — typically path or permission problems, not metadata problems.","triggerScenarios":"new FileOutputStream(dataFile, false) throws FileNotFoundException (directory does not exist, no write permission, path is a directory), or OutputStreamWriter with a bad encoding name throws UnsupportedEncodingException (subclass of IOException).","commonSituations":"Data file path points to a non-existent or read-only directory; running as a user without write access; invalid/typo'd character encoding configured in the step (e.g. 'utf8 ' vs 'UTF-8' handled differently by some JVMs); disk full on temp volume.","solutions":["Verify the directory in the data file path exists and is writable by the PDI user (mkdir/chmod)","Validate the configured encoding is a supported charset name (use Charset.isSupported) or switch to UTF-8","Check available disk space on the target filesystem","Inspect the wrapped cause (e.getCause()) for the precise IOException"],"exampleFix":"// before\nFile f = new File(\"/nonexistent/dir/data.txt\");\n// after\nFile dir = new File(\"/data/load\");\ndir.mkdirs();\nFile f = new File(dir, \"data.txt\");","handlingStrategy":"try-catch","validationCode":"File dir = new File(dataFile).getParentFile();\nif (dir == null || !dir.isDirectory() || !dir.canWrite()) throw new IllegalStateException(\"Cannot write to dir: \" + dir);\nCharset c = Charset.isSupported(encoding) ? Charset.forName(encoding) : StandardCharsets.UTF_8;","typeGuard":null,"tryCatchPattern":"try { dataOutput.open(); } catch (KettleException e) {\n  Throwable cause = e.getCause();\n  if (cause instanceof FileNotFoundException) { /* fix path/permissions */ }\n  else if (cause instanceof java.nio.charset.UnsupportedCharsetException || cause instanceof UnsupportedEncodingException) { /* fix encoding */ }\n  throw e;\n}","preventionTips":["Pre-create and chmod the data-file directory for the PDI service user","Use standard charset names like UTF-8, never locale aliases","Monitor disk space on the volume holding load files","Always read e.getCause() — this error wraps a specific IOException"],"tags":["io","file-write","kettle","encoding"],"backgroundTag":"file-open-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"}