pentaho/pentaho-kettle · error · KettleFileException

: Unable to write value data to output stream

Error message

 : Unable to write value data to output stream

What it means

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).

Solutions

  1. Inspect the wrapped cause (e.getCause()) to identify the underlying I/O fault
  2. Verify the socket/file underlying the DataOutputStream is open and healthy before/during transfer
  3. Check remote host availability and disk space/permissions when streaming or writing to files

Example fix

// before
valueMeta.writeData(outputStream, object); // stream already closed
// after
try (DataOutputStream out = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream()))) {
  valueMeta.writeData(out, object);
  out.flush();
} catch (KettleFileException e) {
  LOG.error("write failed: " + e.getCause(), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight the stream before serializing rows:
if (outputStream == null) throw new IllegalStateException("Output stream is closed");
outputStream.flush(); // fail fast on broken sockets/pipes before writing the batch

Try / catch

try {
  valueMeta.writeData(out, object);
  out.flush();
} catch (KettleFileException e) {
  Throwable cause = e.getCause();
  if (cause instanceof IOException) {
    LOG.error("Stream write failed for field " + valueMeta.getName() + ": " + cause.getMessage());
    // reopen/repair the underlying socket or file, then retry from checkpoint
  } else { throw e; }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/f5b25b0f1c48ca11. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java:2788

            // at all.
            //
            writeBinaryString( outputStream, (byte[]) object );
            break;

          case STORAGE_TYPE_INDEXED:
            writeInteger( outputStream, (Integer) object ); // just an index
            break;

          default:
            throw new KettleFileException( toString() + " : Unknown storage type " + getStorageType() );
        }
      }
    } catch ( ClassCastException e ) {
      throw new RuntimeException( toString() + " : There was a data type error: the data type of "
          + object.getClass().getName() + " object [" + object + "] does not correspond to value meta ["
          + toStringMeta() + "]" );
    } catch ( IOException e ) {
      throw new KettleFileException( toString() + " : Unable to write value data to output stream", e );
    }

  }

  @Override
  public Object readData( DataInputStream inputStream ) throws KettleFileException, KettleEOFException,
    SocketTimeoutException {
    try {
      // Is the value NULL?
      if ( inputStream.readBoolean() ) {
        return null; // done
      }

      switch ( storageType ) {
        case STORAGE_TYPE_NORMAL:
          // Handle Content -- only when not NULL
          switch ( getType() ) {
            case TYPE_STRING:

View on GitHub (pinned to f3058517a1)