{"record":{"id":"cb873227707a64a5","repo":"pentaho/pentaho-kettle","slug":"io-exception-occured","errorCode":null,"errorMessage":"IO exception occured: ","messagePattern":"IO exception occured: ","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkDataOutput.java","lineNumber":86,"sourceCode":"      // else\n      // {\n      // Else open the data file filled in.\n      String dataFile = meta.getDataFile();\n      dataFile = space.environmentSubstitute( dataFile );\n\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( \"IO exception occured: \" + 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  private String createEscapedString( String orig, String enclosure ) {\n    StringBuffer buf = new StringBuffer( orig );\n\n    Const.repl( buf, enclosure, enclosure + enclosure );\n    return buf.toString();","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkDataOutput.java#L68-L104","documentation":"GPBulkDataOutput.open wraps any IOException raised while opening the bulk data output file for the Greenplum bulk loader into a KettleException prefixed with 'IO exception occured: '. The PrintWriter/OutputStreamWriter around the file's OutputStream cannot be constructed, typically because the file or encoding is unusable.","triggerScenarios":"Calling open() during step initialization when the target data file cannot be written: directory does not exist, no write permission, filename invalid, or the configured encoding is not a supported charset name.","commonSituations":"Output directory missing or mounted read-only; filename pointing to a location the Pentaho user cannot write; typo in the character encoding name (e.g. 'UTF8 ' with a space or 'utf-88'); gpfdist data file path configured on a remote host where the local process has no filesystem access.","solutions":["Check the nested IOException message — it names the missing directory, permission problem, or unsupported encoding.","Create the output directory and grant the Pentaho process write permission.","Correct the file name/path in the step's data file setting.","Set a valid encoding (e.g. 'UTF-8') in the step dialog."],"exampleFix":"// before: invalid encoding and missing directory\nencoding = \"utf-88\"; // UnsupportedEncodingException -> IOException\nfilename = \"/nonexistent/dir/data.txt\";\n\n// after\nencoding = \"UTF-8\";\nfilename = \"/opt/pentaho/gpload/data.txt\"; // directory exists and is writable","handlingStrategy":"validation","validationCode":"File f = new File( dataFile );\nif ( !f.getParentFile().exists() || !f.getParentFile().canWrite() ) {\n  throw new KettleException( \"Data file directory missing or not writable: \" + f.getParent() );\n}\nCharset.forName( encoding ); // throws if encoding name is invalid","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the gpfdist data-file directory exists and is writable by the Pentaho user","Validate the encoding name (UTF-8, ISO-8859-1) in the step dialog","Use local paths accessible to the Pentaho process, not remote-only paths"],"tags":["io","file-write","greenplum"],"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"}