apache/hadoop · error · IOException

Corrupted meta index: negative entry count

Error message

Corrupted meta index: negative entry count 

What it means

Error "Corrupted meta index: negative entry count " thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/file/tfile/BCFile.java:775

  }

  /**
   * Index for all Meta blocks.
   */
  static class MetaIndex {
    // use a tree map, for getting a meta block entry by name
    final Map<String, MetaIndexEntry> index;

    // for write
    public MetaIndex() {
      index = new TreeMap<String, MetaIndexEntry>();
    }

    // for read, construct the map from the file
    public MetaIndex(DataInput in) throws IOException {
      int count = Utils.readVInt(in);
      if (count < 0) {
        throw new IOException("Corrupted meta index: negative entry count "
            + count);
      }
      index = new TreeMap<String, MetaIndexEntry>();

      for (int nx = 0; nx < count; nx++) {
        MetaIndexEntry indexEntry = new MetaIndexEntry(in);
        index.put(indexEntry.getMetaName(), indexEntry);
      }
    }

    public void addEntry(MetaIndexEntry indexEntry) {
      index.put(indexEntry.getMetaName(), indexEntry);
    }

    public MetaIndexEntry getMetaByName(String name) {
      return index.get(name);
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. The meta index is corrupted; regenerate the file and verify the write completed and was synced.

When it happens

Trigger: 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.

Common situations: 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.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/4afedad065aae6e5. Report an issue: GitHub.