{"record":{"id":"026312868adb4f88","repo":"pentaho/pentaho-kettle","slug":"unable-to-write-value-data-to-output-stream","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/compatibility/Value.java","lineNumber":1699,"sourceCode":"            if ( getDate() != null ) {\n              dos.writeLong( getDate().getTime() );\n            }\n            break;\n          case VALUE_TYPE_NUMBER:\n            dos.writeDouble( getNumber() );\n            break;\n          case VALUE_TYPE_BOOLEAN:\n            dos.writeBoolean( getBoolean() );\n            break;\n          case VALUE_TYPE_INTEGER:\n            dos.writeLong( getInteger() );\n            break;\n          default:\n            break; // nothing\n        }\n      }\n    } catch ( IOException e ) {\n      throw new KettleFileException( \"Unable to write value data to output stream\", e );\n    }\n\n    return true;\n  }\n\n  /**\n   * Read the data of a Value from a DataInputStream, the meta-data of the value has to be set before calling this\n   * method!\n   *\n   * @param dis\n   *          the DataInputStream to read from\n   * @throws KettleFileException\n   *           when the value couldn't be read from the DataInputStream\n   */\n  public Value( Value metaData, DataInputStream dis ) throws KettleFileException {\n    setValue( metaData );\n    setName( metaData.getName() );\n","sourceCodeStart":1681,"sourceCodeEnd":1717,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/compatibility/Value.java#L1681-L1717","documentation":"This KettleFileException is thrown by Value.writeObj's data-writing path when an IOException occurs while writing the value's payload to a DataOutputStream. It wraps low-level stream failures (disk full, closed/broken stream, network failure) into Kettle's checked exception type so callers of value serialization get a single error type.","triggerScenarios":"Calling the Value serialization/write API (writeObj / row serialization to file or socket) when the underlying OutputStream is closed, broken (broken pipe), out of disk space, or a network socket dies mid-write.","commonSituations":"Writing kettle data files to a full disk; a consumer closed the pipe/socket while the producer still writes; network interruptions during streaming output; writing to a file on a read-only or removed mount.","solutions":["Check disk space and write permissions on the target before starting the write.","Ensure the consumer keeps the socket/pipe open until the producer finishes (fix premature close on the reader side).","Retry the whole write operation on transient network errors, writing to a temp file and renaming on success.","Wrap output in BufferedOutputStream and close in try-with-resources to avoid resource leaks causing later failures.","Catch KettleFileException and inspect getCause() (IOException) for the concrete OS-level reason."],"exampleFix":"// before\nvalue.writeObj( dos ); // KettleFileException if stream broken\n// after\ntry {\n  value.writeObj( dos );\n  dos.flush();\n} catch ( KettleFileException e ) {\n  throw new IOException( \"Failed to persist value data: \" + e.getCause().getMessage(), e );\n}","handlingStrategy":"try-catch","validationCode":"// pre-flight checks before writing\nFile target = new File( path );\nif ( target.getUsableSpace() < requiredBytes ) throw new IOException( \"Insufficient disk space\" );\nif ( !target.getParentFile().canWrite() ) throw new IOException( \"No write permission: \" + path );","typeGuard":null,"tryCatchPattern":"try {\n  value.writeObj( dos );\n  dos.flush();\n} catch ( KettleFileException e ) {\n  if ( e.getCause() instanceof IOException && isTransient( (IOException) e.getCause() ) ) {\n    retryWrite();\n  } else {\n    throw e;\n  }\n}","preventionTips":["Monitor disk space and mount health on write targets.","Keep consumers' sockets/streams open until all data is written.","Write to temp file + atomic rename for durability.","Close streams in try-with-resources.","Retry transient I/O failures with backoff."],"tags":["io","serialization","streaming"],"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"}