{"record":{"id":"bc9b536cd9a05124","repo":"pentaho/pentaho-kettle","slug":"unable-to-read-nr-of-metadata-values-e-tostring","errorCode":null,"errorMessage":"Unable to read nr of metadata values: ${e.toString()}","messagePattern":"Unable to read nr of metadata values: (.+?)","errorType":"exception","errorClass":"org.pentaho.di.core.exception.KettleFileException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/RowMeta.java","lineNumber":730,"sourceCode":"    } finally {\n      lock.readLock().unlock();\n    }\n\n  }\n\n  public RowMeta( DataInputStream inputStream ) throws KettleFileException, SocketTimeoutException {\n    this();\n\n    int nr;\n    try {\n      nr = inputStream.readInt();\n    } catch ( SocketTimeoutException e ) {\n      throw e;\n    } catch ( EOFException e ) {\n      throw new KettleEOFException(\n        \"End of file while reading the number of metadata values in the row metadata\", e );\n    } catch ( IOException e ) {\n      throw new KettleFileException( \"Unable to read nr of metadata values: \" + e.toString(), e );\n    }\n\n    for ( int i = 0; i < nr; i++ ) {\n      try {\n        int type = inputStream.readInt();\n        ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( type );\n        valueMeta.readMetaData( inputStream );\n        addValueMeta( valueMeta );\n      } catch ( EOFException e ) {\n        throw new KettleEOFException( e );\n      } catch ( Exception e ) {\n        throw new KettleFileException( toString() + \" : Unable to read row metadata from input stream\", e );\n      }\n\n    }\n  }\n\n  @Override","sourceCodeStart":712,"sourceCodeEnd":748,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/RowMeta.java#L712-L748","documentation":"While reading the field count in the RowMeta(InputStream) constructor, a generic IOException (not EOF, not socket timeout) is wrapped in KettleFileException with the message \"Unable to read nr of metadata values: \" plus the IOException's toString. This indicates an I/O problem other than a clean end-of-stream.","triggerScenarios":"Calling new RowMeta(inputStream) when readInt throws a non-EOF IOException: connection reset, SSL error, underlying file I/O failure, or stream corruption on a socket.","commonSituations":"Network resets mid-metadata handshake between PDI cluster nodes; TLS/cipher mismatch causing read failures; filesystem errors reading a corrupt or inaccessible metadata file.","solutions":["Parse the appended e.toString() to identify the exact I/O failure (connection reset, SSL handshake, disk error).","For socket streams, re-establish the connection and retry the metadata read.","For file streams, verify the file exists, is readable, and is not corrupted; regenerate it from the source.","Distinguish SocketTimeoutException (rethrown upstream for retry) from other IOExceptions needing reconnect logic."],"exampleFix":"// before\nRowMeta rowMeta = new RowMeta(inputStream);\n// after\ntry {\n  RowMeta rowMeta = new RowMeta(inputStream);\n} catch (KettleFileException e) {\n  log.error(\"Metadata read I/O failure: \" + e.getMessage(), e);\n  inputStream = reconnect();\n  RowMeta rowMeta = new RowMeta(inputStream);\n}","handlingStrategy":"retry","validationCode":"if (inputStream == null) { throw new IllegalStateException(\"Input stream is null\"); }\nif (inputStream instanceof SocketInputStream && !isConnected(socket)) { reconnect(); }","typeGuard":null,"tryCatchPattern":"try {\n  RowMeta rowMeta = new RowMeta(inputStream);\n} catch (KettleFileException e) {\n  log.error(\"I/O failure reading field count: \" + e.getMessage(), e);\n  inputStream = reconnect();\n  RowMeta rowMeta = new RowMeta(inputStream);\n}","preventionTips":["Use connection health checks before metadata exchange.","Parse e.getMessage()'s appended IOException text to classify faults.","Regenerate corrupt source files instead of retrying reads."],"tags":["io","network","deserialization","row-metadata"],"backgroundTag":"file-read-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"}