{"record":{"id":"e1e2bf070f20c098","repo":"apache/hadoop","slug":"rec-negative-value-length","errorCode":null,"errorMessage":"Rec# {}: Negative value-length: {}","messagePattern":"Rec# (.+?): Negative value-length: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IFile.java","lineNumber":413,"sourceCode":"      // Read key and value lengths\n      currentKeyLength = WritableUtils.readVInt(dIn);\n      currentValueLength = WritableUtils.readVInt(dIn);\n      bytesRead += (long) WritableUtils.getVIntSize(currentKeyLength) +\n                   WritableUtils.getVIntSize(currentValueLength);\n      \n      // Check for EOF\n      if (currentKeyLength == EOF_MARKER && currentValueLength == EOF_MARKER) {\n        eof = true;\n        return false;\n      }\n      \n      // Sanity check\n      if (currentKeyLength < 0) {\n        throw new IOException(\"Rec# \" + recNo + \": Negative key-length: \" + \n                              currentKeyLength);\n      }\n      if (currentValueLength < 0) {\n        throw new IOException(\"Rec# \" + recNo + \": Negative value-length: \" + \n                              currentValueLength);\n      }\n            \n      return true;\n    }\n    \n    public boolean nextRawKey(DataInputBuffer key) throws IOException {\n      if (!positionToNextRecord(dataIn)) {\n        return false;\n      }\n      if (keyBytes.length < currentKeyLength) {\n        keyBytes = new byte[currentKeyLength << 1];\n      }\n      int i = readData(keyBytes, 0, currentKeyLength);\n      if (i != currentKeyLength) {\n        throw new IOException (\"Asked for \" + currentKeyLength + \" Got: \" + i);\n      }\n      key.reset(keyBytes, currentKeyLength);","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IFile.java#L395-L431","documentation":"Error \"Rec# {}: Negative value-length: {}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IFile.java:413 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The spill file is corrupt; rerun the task to regenerate the spill data and check the node for disk or memory faults."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}