{"record":{"id":"f5b25b0f1c48ca11","repo":"pentaho/pentaho-kettle","slug":"unable-to-write-value-data-to-output-stream-valuemetabase","errorCode":null,"errorMessage":" : Unable to write value data to output stream","messagePattern":" : Unable to write value data to output stream","errorType":"exception","errorClass":"KettleFileException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":2788,"sourceCode":"            // at all.\n            //\n            writeBinaryString( outputStream, (byte[]) object );\n            break;\n\n          case STORAGE_TYPE_INDEXED:\n            writeInteger( outputStream, (Integer) object ); // just an index\n            break;\n\n          default:\n            throw new KettleFileException( toString() + \" : Unknown storage type \" + getStorageType() );\n        }\n      }\n    } catch ( ClassCastException e ) {\n      throw new RuntimeException( toString() + \" : There was a data type error: the data type of \"\n          + object.getClass().getName() + \" object [\" + object + \"] does not correspond to value meta [\"\n          + toStringMeta() + \"]\" );\n    } catch ( IOException e ) {\n      throw new KettleFileException( toString() + \" : Unable to write value data to output stream\", e );\n    }\n\n  }\n\n  @Override\n  public Object readData( DataInputStream inputStream ) throws KettleFileException, KettleEOFException,\n    SocketTimeoutException {\n    try {\n      // Is the value NULL?\n      if ( inputStream.readBoolean() ) {\n        return null; // done\n      }\n\n      switch ( storageType ) {\n        case STORAGE_TYPE_NORMAL:\n          // Handle Content -- only when not NULL\n          switch ( getType() ) {\n            case TYPE_STRING:","sourceCodeStart":2770,"sourceCodeEnd":2806,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L2770-L2806","documentation":"KettleFileException thrown by ValueMetaBase.writeData wrapping an underlying IOException: the value could not be written to the DataOutputStream. The type conversion succeeded, but the stream itself failed (closed, broken connection, disk/socket error).","triggerScenarios":"writeData() called on a DataOutputStream backed by a socket or file that has been closed, reset, or hit an I/O fault mid-row transfer (cluster streaming, Kettle file output).","commonSituations":"Peer cluster node died during row streaming (broken pipe); output file system full or permission denied; stream closed prematurely by another thread or an earlier error path.","solutions":["Inspect the wrapped cause (e.getCause()) to identify the underlying I/O fault","Verify the socket/file underlying the DataOutputStream is open and healthy before/during transfer","Check remote host availability and disk space/permissions when streaming or writing to files"],"exampleFix":"// before\nvalueMeta.writeData(outputStream, object); // stream already closed\n// after\ntry (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()))) {\n  valueMeta.writeData(out, object);\n  out.flush();\n} catch (KettleFileException e) {\n  LOG.error(\"write failed: \" + e.getCause(), e);\n}","handlingStrategy":"try-catch","validationCode":"// Pre-flight the stream before serializing rows:\nif (outputStream == null) throw new IllegalStateException(\"Output stream is closed\");\noutputStream.flush(); // fail fast on broken sockets/pipes before writing the batch","typeGuard":null,"tryCatchPattern":"try {\n  valueMeta.writeData(out, object);\n  out.flush();\n} catch (KettleFileException e) {\n  Throwable cause = e.getCause();\n  if (cause instanceof IOException) {\n    LOG.error(\"Stream write failed for field \" + valueMeta.getName() + \": \" + cause.getMessage());\n    // reopen/repair the underlying socket or file, then retry from checkpoint\n  } else { throw e; }\n}","preventionTips":["Check peer/node liveness before streaming batches","Wrap streams in BufferedOutputStream and flush per batch to surface errors early","Monitor disk space and permissions on file-based outputs","Close streams exactly once and only after all writers finish"],"tags":["kettle","pdi","ioexception","serialization","stream"],"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"}