apache/cassandra · critical · RuntimeException

Error seeking to rowIds offset for ordinal

Error message

Error seeking to rowIds offset for ordinal %d with ordToRowOffset %d

What it means

RuntimeException thrown when the seek to the per-ordinal rowIds (postings) offset fails in getSegmentRowIdsMatching. After reading the offset for a vector ordinal, the reader seeks to it to read the postings list; failure means the offset is invalid or the file region is unreadable/corrupt.

Solutions

  1. REBUILD the vector index (or scrub the SSTable) to regenerate valid postings offsets
  2. Restore a consistent set of index component files from a good backup
  3. Inspect the chained cause for the underlying IO/mmap error and check the storage medium
  4. Verify the reader/writer SAI format versions match across the cluster

Example fix

// before
long offset = reader.readLong();
reader.seek(offset); // may throw wrapped RuntimeException
// after
long offset = reader.readLong();
if (offset < 0 || offset >= segmentEnd)
    throw new CorruptIndexException("invalid postings offset " + offset, ...);
reader.seek(offset);
Defensive patterns

Strategy: try-catch

Validate before calling

long offset = readPostingsOffset(ordinal);
if (offset < 0 || offset >= segmentEnd)
    throw new CorruptIndexException("postings offset out of bounds: " + offset, "vector");

Type guard

boolean postingsOffsetValid(long offset, long segmentEnd) {
    return offset >= 0 && offset < segmentEnd;
}

Try / catch

try {
    reader.seek(offset);
} catch (RuntimeException e) {
    logger.error("Postings seek failed for ordinal {}: {}", ordinal, e.getMessage(), e);
    markSegmentCorrupt(segmentOffset);
}

Prevention

When it happens

Trigger: Querying a vector ordinal whose postings offset points outside the file, truncated postings area, corrupted ordinal map contents, or mismatched segment files.

Common situations: Disk corruption, incomplete flush of vector index segments, mixing files across segment generations, or storage read errors under the mmap layer.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/132fd53820ff01da. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/index/sai/disk/v1/vector/OnDiskOrdinalsMap.java:105

            // read index entry
            try
            {
                reader.seek(ordToRowOffset + 4L + vectorOrdinal * 8L);
            }
            catch (Exception e)
            {
                throw new RuntimeException(String.format("Error seeking to index offset for ordinal %d with ordToRowOffset %d",
                                                         vectorOrdinal, ordToRowOffset), e);
            }
            long offset = reader.readLong();
            // seek to and read rowIds
            try
            {
                reader.seek(offset);
            }
            catch (Exception e)
            {
                throw new RuntimeException(String.format("Error seeking to rowIds offset for ordinal %d with ordToRowOffset %d",
                                                         vectorOrdinal, ordToRowOffset), e);
            }
            int postingsSize = reader.readInt();
            int[] rowIds = new int[postingsSize];
            for (int i = 0; i < rowIds.length; i++)
            {
                rowIds[i] = reader.readInt();
            }
            return rowIds;
        }

        @Override
        public void close()
        {
            reader.close();
        }
    }

View on GitHub (pinned to 88fd0f6a0e)