{"record":{"id":"50708b8235a8e11b","repo":"pentaho/pentaho-kettle","slug":"tostring-unable-to-read-value-metadata-from-input-stream","errorCode":null,"errorMessage":"<toString()> : Unable to read value metadata from input stream","messagePattern":"<toString\\(\\)> : 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":361,"sourceCode":"  }\n\n  /**\n   * Create a new Value meta object.\n   *\n   * @param inputStream\n   * @throws KettleFileException\n   * @throws KettleEOFException\n   * @deprecated in favor of a combination of {@link ValueMetaFactory}.createValueMeta() and the loadMetaData() method.\n   */\n  @Deprecated\n  public ValueMetaBase( DataInputStream inputStream ) throws KettleFileException, KettleEOFException {\n    this();\n    try {\n      type = inputStream.readInt();\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    readMetaData( inputStream );\n  }\n\n  /**\n   * @deprecated use {@link #ValueMetaBase(String, int)} and {@link #setStorageType(int)} instead\n   *\n   * @param name\n   * @param type\n   * @param storageType\n   */\n  @Deprecated\n  public ValueMetaBase( String name, int type, int storageType ) {\n    this( name, type, -1, -1 );\n    this.storageType = storageType;\n    setDefaultConversionMask();\n  }","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L343-L379","documentation":"Thrown when an IOException (other than EOF) occurs reading the type int from the DataInputStream in the deprecated ValueMetaBase(DataInputStream) constructor. It wraps the underlying IO problem and prefixes the value metadata name, indicating the value metadata could not be read from the stream.","triggerScenarios":"new ValueMetaBase(dataInputStream) while the underlying stream is closed, broken, or the source file/pipe disappears mid-read — any IOException thrown by readInt() that is not EOFException.","commonSituations":"Reading a binary file truncated by an earlier failed write; socket/file stream closed by another thread; disk or network failure while streaming Kettle binary metadata.","solutions":["Verify the source file/stream is complete and not truncated (compare size/checksum)","Ensure the writer finished and flushed/closed the stream before reading","Check filesystem/network health; retry the read on a fresh stream","Stop using the deprecated constructor; use the current metadata serialization API"],"exampleFix":"// before\nValueMetaBase vm = new ValueMetaBase(dis); // KettleFileException on broken stream\n// after\nif (file.length() == 0 || !file.canRead()) {\n  throw new KettleFileException(\"Input file missing or empty: \" + file);\n}\nValueMetaBase vm = new ValueMetaBase(new DataInputStream(new BufferedInputStream(new FileInputStream(file))));","handlingStrategy":"try-catch","validationCode":"File f = new File(path);\nif (!f.isFile() || !f.canRead() || f.length() == 0) {\n  throw new KettleFileException(\"Cannot read metadata file: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  ValueMetaBase vm = new ValueMetaBase(dis);\n} catch (KettleFileException e) {\n  Throwable cause = e.getCause(); // IOException details\n  log.error(\"Stream broken reading value metadata: \" + cause, cause);\n  throw e;\n}","preventionTips":["Keep stream open until all reads complete; don't close in another thread","Buffer reads (BufferedInputStream) to reduce partial-read failures","Verify file integrity (size/checksum) for transferred files","Use the non-deprecated metadata serialization API"],"tags":["io","stream","kettle","file-read"],"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"}