{"record":{"id":"2cfdedcfedf7c115","repo":"pentaho/pentaho-kettle","slug":"jsonoutput-error-writing","errorCode":"JsonOutput.Error.Writing","errorMessage":"JsonOutput.Error.Writing","messagePattern":"JsonOutput\\.Error\\.Writing","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java","lineNumber":251,"sourceCode":"\n\n    if ( data.outputValue && data.outputRowMeta != null ) {\n      Object[] outputRowData = RowDataUtil.addValueData( rowData, data.inputRowMetaSize, value );\n      incrementLinesOutput();\n      putRow( data.outputRowMeta, outputRowData );\n    }\n\n    if ( data.writeToFile && !data.ja.isEmpty() ) {\n      // Open a file\n      if ( !openNewFile() ) {\n        throw new KettleStepException( BaseMessages.getString(\n          PKG, \"JsonOutput.Error.OpenNewFile\", buildFilename() ) );\n      }\n      // Write data to file\n      try {\n        data.writer.write( value );\n      } catch ( Exception e ) {\n        throw new KettleStepException( BaseMessages.getString( PKG, \"JsonOutput.Error.Writing\" ), e );\n      }\n      // Close file\n      closeFile();\n    }\n    // Data are safe\n    data.rowsAreSafe = true;\n    data.ja = new JSONArray();\n  }\n\n  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {\n    meta = (JsonOutputMeta) smi;\n    data = (JsonOutputData) sdi;\n    if ( super.init( smi, sdi ) ) {\n\n      data.writeToFile = ( meta.getOperationType() != JsonOutputMeta.OPERATION_TYPE_OUTPUT_VALUE );\n      data.outputValue = ( meta.getOperationType() != JsonOutputMeta.OPERATION_TYPE_WRITE_TO_FILE );\n\n      if ( data.outputValue ) {","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java#L233-L269","documentation":"JsonOutput.outPutRow wraps data.writer.write(value) in a try/catch; any exception while writing the JSON string to the open file is rethrown as JsonOutput.Error.Writing. This indicates the file was opened but the write operation itself failed (disk full, stream closed, IO error).","triggerScenarios":"data.writer.write(value) throws — e.g. IOException from a full disk, detached network drive, stream already closed, or character encoding problems — inside outPutRow after openNewFile() succeeded.","commonSituations":"Disk quota exceeded on the output volume; writing to a network share that dropped mid-run; antivirus or backup software locking the file during the write; container filesystem turned read-only.","solutions":["Check free disk space and quotas on the target filesystem.","Verify the output location is a stable, writable local or mounted path; avoid flaky network shares for output.","Check OS-level logs for IO errors and any antivirus/backup interference with the output file.","Re-run the transformation; if transient, add retry logic at the job level.","Confirm the file encoding selected in the step is supported by the JVM/platform."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { transformation.execute(...); } catch (KettleStepException e) {\n  if (e.getMessage().contains(\"JsonOutput.Error.Writing\")) {\n    log.error(\"Write failed: check disk space and target volume health\", e);\n  }\n  throw e;\n}","preventionTips":["Monitor free disk space on output volumes and set alerts.","Prefer local disk for output, then move/copy to network storage afterwards.","Exclude output directories from antivirus/backup scans during runs.","Check JVM/platform encoding support for the chosen file encoding."],"tags":["pdi","file-io","ioexception","kettle","json-output"],"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"}