{"record":{"id":"cbe7f0560b0c87a7","repo":"pentaho/pentaho-kettle","slug":"error-reading-value-data-from-stream","errorCode":null,"errorMessage":"Error reading value data from stream","messagePattern":"Error reading value data from stream","errorType":"exception","errorClass":"KettleEOFException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/compatibility/Value.java","lineNumber":1777,"sourceCode":"            }\n            break;\n          case VALUE_TYPE_NUMBER:\n            setValue( dis.readDouble() );\n            break;\n          case VALUE_TYPE_INTEGER:\n            setValue( dis.readLong() );\n            break;\n          case VALUE_TYPE_BOOLEAN:\n            setValue( dis.readBoolean() );\n            break;\n          default:\n            break;\n        }\n      }\n    } catch ( EOFException e ) {\n      throw new KettleEOFException( \"End of file reached while reading value\", e );\n    } catch ( Exception e ) {\n      throw new KettleEOFException( \"Error reading value data from stream\", e );\n    }\n  }\n\n  /**\n   * Compare 2 values of the same or different type! The comparison of Strings is case insensitive\n   *\n   * @param v\n   *          the value to compare with.\n   * @return -1 if The value was smaller, 1 bigger and 0 if both values are equal.\n   */\n  public int compare( Value v ) {\n    return compare( v, true );\n  }\n\n  /**\n   * Compare 2 values of the same or different type!\n   *\n   * @param v","sourceCodeStart":1759,"sourceCodeEnd":1795,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/compatibility/Value.java#L1759-L1795","documentation":"This KettleEOFException (with message 'Error reading value data from stream') is thrown by Value.readObj when any non-EOF exception occurs while reading the value's type-specific payload from the stream. Unlike the truncation case, this indicates a format/corruption problem: bad length prefixes, invalid primitives, or mismatched serialization versions.","triggerScenarios":"Value.readObj encountering invalid data mid-value: corrupted length fields causing negative/huge array reads, wrong UTF data, incompatible wire format from a different Kettle version, or reading a stream positioned in the middle of a record.","commonSituations":"Random-access reads landing mid-record; files written by newer/older PDI versions; bit-rotted archives; mixing binary and text streams; seeking with a wrong offset into a Kettle data file.","solutions":["Re-align the stream to a valid record boundary before deserializing (store/seek to known offsets).","Match writer and reader PDI versions; re-export the file if formats changed.","Validate file integrity with checksums; regenerate corrupted data.","Ensure only one consumer reads the stream and no external code repositions it.","Log e.getCause() when catching KettleEOFException to identify which primitive read failed and fix the writer accordingly."],"exampleFix":"// before\nin.skip( guessedOffset );\nValue v = new Value( in ); // mid-record -> error\n// after\nlong offset = rowOffsets.get( rowIndex ); // offsets recorded at write time\nin.skip( offset );\nValue v = new Value( in );","handlingStrategy":"try-catch","validationCode":"// verify integrity before deserialization\nif ( !checksumMatches( file, expectedSha256 ) ) throw new IOException( \"Corrupt data file: \" + file );","typeGuard":null,"tryCatchPattern":"try {\n  Value v = new Value( in );\n} catch ( KettleEOFException e ) {\n  // non-EOF cause wrapped: corruption or format mismatch\n  throw new IOException( \"Bad value record at offset \" + bytesRead + \": \" + e.getCause(), e );\n}","preventionTips":["Record row offsets at write time instead of guessing seek positions.","Version-stamp serialized files and check on read.","Never share one InputStream between independent readers.","Verify checksums before reading.","Keep writer/reader Kettle versions compatible."],"tags":["io","deserialization","corruption","streaming"],"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"}