{"record":{"id":"4afedad065aae6e5","repo":"apache/hadoop","slug":"corrupted-meta-index-negative-entry-count","errorCode":null,"errorMessage":"Corrupted meta index: negative entry count ","messagePattern":"Corrupted meta index: negative entry count ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java","lineNumber":775,"sourceCode":"  }\n\n  /**\n   * Index for all Meta blocks.\n   */\n  static class MetaIndex {\n    // use a tree map, for getting a meta block entry by name\n    final Map<String, MetaIndexEntry> index;\n\n    // for write\n    public MetaIndex() {\n      index = new TreeMap<String, MetaIndexEntry>();\n    }\n\n    // for read, construct the map from the file\n    public MetaIndex(DataInput in) throws IOException {\n      int count = Utils.readVInt(in);\n      if (count < 0) {\n        throw new IOException(\"Corrupted meta index: negative entry count \"\n            + count);\n      }\n      index = new TreeMap<String, MetaIndexEntry>();\n\n      for (int nx = 0; nx < count; nx++) {\n        MetaIndexEntry indexEntry = new MetaIndexEntry(in);\n        index.put(indexEntry.getMetaName(), indexEntry);\n      }\n    }\n\n    public void addEntry(MetaIndexEntry indexEntry) {\n      index.put(indexEntry.getMetaName(), indexEntry);\n    }\n\n    public MetaIndexEntry getMetaByName(String name) {\n      return index.get(name);\n    }\n","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java#L757-L793","documentation":"Error \"Corrupted meta index: negative entry count \" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java:775 when the library encounters an invalid state.","commonSituations":"Occurs when the BCFile meta index contains a negative entry count, indicating corruption. Treat the file as corrupt; verify file integrity and rewrite if needed.","solutions":["The meta index is corrupted; regenerate the file and verify the write completed and was synced."],"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"}