{"record":{"id":"a09fedf557964c01","repo":"pentaho/pentaho-kettle","slug":"unable-to-read-value-metadata-from-input-stream","errorCode":null,"errorMessage":" : Unable to read value metadata from input stream","messagePattern":" : Unable to read value metadata from input stream","errorType":"exception","errorClass":"KettleFileException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":3231,"sourceCode":"      } else {\n        dateFormatLocale = EnvUtil.createLocale( strDateFormatLocale );\n      }\n\n      // What is the time zone to use for date parsing?\n      //\n      String strTimeZone = readString( inputStream );\n      if ( Utils.isEmpty( strTimeZone ) ) {\n        dateFormatTimeZone = TimeZone.getDefault();\n      } else {\n        dateFormatTimeZone = EnvUtil.createTimeZone( strTimeZone );\n      }\n\n      // is string to number parsing lenient?\n      lenientStringToNumber = inputStream.readBoolean();\n    } catch ( EOFException e ) {\n      throw new KettleEOFException( e );\n    } catch ( IOException e ) {\n      throw new KettleFileException( toString() + \" : Unable to read value metadata from input stream\", e );\n    }\n\n  }\n\n  @Override\n  public String getMetaXML() throws IOException {\n    StringBuilder xml = new StringBuilder();\n\n    xml.append( XMLHandler.openTag( XML_META_TAG ) );\n\n    xml.append( XMLHandler.addTagValue( \"type\", getTypeDesc() ) );\n    xml.append( XMLHandler.addTagValue( \"storagetype\", getStorageTypeCode( getStorageType() ) ) );\n\n    switch ( storageType ) {\n      case STORAGE_TYPE_INDEXED:\n        xml.append( XMLHandler.openTag( \"index\" ) );\n\n        // Save the indexed strings...","sourceCodeStart":3213,"sourceCodeEnd":3249,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L3213-L3249","documentation":"ValueMetaBase.readMetaData reads this value meta's attributes back from a DataInputStream. If a low-level IOException occurs during the reads it is wrapped in a KettleFileException with this message; if the stream ends prematurely an EOFException is instead wrapped in KettleEOFException. The message means the metadata could not be read from the stream due to an I/O failure rather than a type problem.","triggerScenarios":"Calling readMetaData(DataInputStream) when the backing file/socket fails mid-read (disk error, connection reset, stream closed by another thread) but not at clean EOF. Any readString/readBoolean call inside the method throwing IOException triggers it.","commonSituations":"Network stream between clustered Carte servers reset mid-transfer; reading metadata from a truncated file; reading a stream produced by a different Kettle version whose field layout mismatches causing garbage/corrupt reads; storage media errors.","solutions":["Inspect getCause() for the root IOException (connection reset, disk I/O error, etc.) and fix that transport or file problem.","Verify the stream was written by a compatible Kettle version; version mismatches can misalign reads and corrupt subsequent reads.","Re-transfer or regenerate the corrupted stream/file and retry the read once the source is intact.","Catch KettleEOFException separately upstream to distinguish a clean premature-end case from a hard I/O failure."],"exampleFix":"// before\nvalueMeta.readMetaData(dataInputStream);\n// after\ntry {\n  valueMeta.readMetaData(dataInputStream);\n} catch (KettleEOFException eof) {\n  throw new KettleException(\"Stream ended before metadata was fully read\", eof);\n} catch (KettleFileException kfe) {\n  throw new KettleException(\"I/O failure reading metadata: \" + kfe.getCause(), kfe);\n}","handlingStrategy":"try-catch","validationCode":"if (inputStream == null) throw new IllegalStateException(\"Input stream is null\");\n// check the socket/file is still alive before metadata reads\nif (inputStream.available() < 0) throw new IllegalStateException(\"Stream already exhausted\");","typeGuard":null,"tryCatchPattern":"try {\n  valueMeta.readMetaData(dataInputStream);\n} catch (KettleEOFException eof) {\n  throw new KettleException(\"Premature end of metadata stream\", eof);\n} catch (KettleFileException kfe) {\n  throw new KettleException(\"I/O error reading metadata: \" + kfe.getCause(), kfe);\n}","preventionTips":["Distinguish KettleEOFException (truncated data) from KettleFileException (I/O failure) when logging.","Verify transfer integrity (checksum/size) before reading streams from the network.","Retry once on transient I/O errors after confirming the source is healthy."],"tags":["io","deserialization","metadata","kettle"],"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"}