pentaho/pentaho-kettle · error · org.pentaho.di.core.exception.KettleFileException
Unable to write nr of metadata values
Error message
Unable to write nr of metadata values
What it means
writeMeta serializes row metadata and first writes an int with the number of fields (size()). If outputStream.writeInt throws IOException, it is wrapped in a KettleFileException "Unable to write nr of metadata values". It indicates the metadata transmission failed at the very first word.
Solutions
- Read the chained IOException cause to identify whether it is broken pipe, stream closed, or disk full.
- Reconnect or reopen the destination stream and retry writeMeta.
- Check available disk space / file permissions when writing metadata to files.
- Avoid sharing one OutputStream across threads without synchronization.
Example fix
// before
rowMeta.writeMeta(outputStream);
// after
try {
rowMeta.writeMeta(outputStream);
} catch (KettleFileException e) {
log.error("Could not write metadata count: " + e.getCause(), e);
outputStream = reopenStream();
rowMeta.writeMeta(outputStream);
} Defensive patterns
Strategy: retry
Validate before calling
if (outputStream == null) { throw new IllegalStateException("Output stream is null"); }
checkDiskSpaceIfFileBacked(outputStream); Try / catch
try {
rowMeta.writeMeta(outputStream);
outputStream.flush();
} catch (KettleFileException e) {
log.error("Metadata write failed: " + e.getCause(), e);
outputStream = reopenStream();
rowMeta.writeMeta(outputStream);
} Prevention
- Verify stream is open/connected before sending metadata.
- Monitor disk space for file-backed streams.
- Synchronize stream access across threads.
When it happens
Trigger: Calling RowMeta.writeMeta(outputStream) where the underlying stream throws IOException on the first writeInt: closed stream, broken socket pipe, disk full, or I/O error on a file-backed stream.
Common situations: Transferring row metadata between PDI servers when the connection dropped before any bytes were sent; writing metadata to a file that hit quota/disk-full; serializing to a stream already consumed/closed by another thread.
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
- Error writing marker flag
- : Unable to read value timestamp data from input stream
- Already closed
- Already closed
- End of file reached
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/638ef97935642c84.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/RowMeta.java:705
} finally {
lock.readLock().unlock();
}
}
/**
* Write ONLY the specified metadata to the outputStream
*
* @throws KettleFileException in case things go awry
*/
@Override
public void writeMeta( DataOutputStream outputStream ) throws KettleFileException {
lock.readLock().lock();
try {
// First handle the number of fields in a row
try {
outputStream.writeInt( size() );
} catch ( IOException e ) {
throw new KettleFileException( "Unable to write nr of metadata values", e );
}
// Write all values in the row
for ( int i = 0; i < size(); i++ ) {
getValueMeta( i ).writeMeta( outputStream );
}
} finally {
lock.readLock().unlock();
}
}
public RowMeta( DataInputStream inputStream ) throws KettleFileException, SocketTimeoutException {
this();
int nr;
try {
nr = inputStream.readInt();View on GitHub (pinned to f3058517a1)