dgraph-io/dgraph · error
error fetching posting list
Error message
error fetching posting list
What it means
errFetchingPostingList is a sentinel error returned by HNSW helper functions (getDataFromKeyWithCacheType, populateEdgeDataFromKeyWithCacheType, getVecFromUid, removeDeadNodes, SearchWithUid/Options) when reading the posting list for a key from Badger fails (the inner error is typically wrapped/logged). It means the vector-index layer could not fetch the underlying postings data for a UID or key.
Source
Thrown at tok/hnsw/helper.go:51
visitedVectorsLevel = "visited_vectors_level_"
distanceComputations = "vector_distance_computations"
searchTime = "vector_search_time"
VecEntry = "__vector_entry"
VecDead = "__vector_dead"
VectorIndexMaxLevels = 5
EfConstruction = 16
EfSearch = 12
// ByteData indicates the key stores data.
ByteData = byte(0x00)
// DefaultPrefix is the prefix used for data, index and reverse keys so that relative
DefaultPrefix = byte(0x00)
// NsSeparator is the separator between the namespace and attribute.
NsSeparator = "-"
)
var (
errNilVector = errors.New("nil vector returned")
errFetchingPostingList = errors.New("error fetching posting list")
)
type SearchResult struct {
nnUids []uint64
traversalPath []uint64
extraMetrics map[string]uint64
}
func (s *SearchResult) GetNnUids() []uint64 {
return s.nnUids
}
func (s *SearchResult) GetTraversalPath() []uint64 {
return s.traversalPath
}
func (s *SearchResult) GetExtraMetrics() map[string]uint64 {
return s.extraMetricsView on GitHub (pinned to 759e242be6)
Solutions
- Inspect the underlying Badger error logged alongside this sentinel to find the root cause
- Retry the query; transient IO/lock issues may resolve
- Run Badger integrity checks / backup-restore tooling if corruption is suspected
- Rebuild the vector index for the predicate if postings remain unreadable
Example fix
// before
res, err := hnsw.SearchWithUid(ctx, index, uid, opts) // errFetchingPostingList
// after
if errors.Is(err, tok.ErrFetchingPostingList) {
log.Warnf("posting list read failed for uid %d, retrying", uid)
res, err = hnsw.SearchWithUid(ctx, index, uid, opts)
} Defensive patterns
Strategy: retry
Validate before calling
// health check before vector queries
if err := dbHealthCheck(ctx); err != nil {
return fmt.Errorf("postings store unhealthy: %w", err)
} Try / catch
res, err := hnsw.SearchWithUid(ctx, idx, uid, opts)
if err != nil {
if errors.Is(err, errFetchingPostingList) {
return backoffRetry(ctx, 3, func() error {
r, e := hnsw.SearchWithUid(ctx, idx, uid, opts); res = r; return e
})
}
return err
} Prevention
- Monitor Badger disk health and IO errors; check logs for the wrapped root cause
- Run integrity/backup tooling after crashes or restores
- Retry transient read failures with backoff before surfacing to users
- Rebuild vector indexes whose postings stay unreadable
When it happens
Trigger: Vector search (SearchWithUid, SearchWithUidAndOptions) or index maintenance (removeDeadNodes) hitting a posting-list read error: DB I/O failure, key corruption, or key not readable at the given read timestamp.
Common situations: Badger disk/IO issues or corrupted SST files after crash; querying with a readTs below/at a problematic timestamp; restore/migration leaving inconsistent postings for vector predicates.
Related errors
- error creating indexer for %s: %w
- nil vector returned
- Not allowed to insert mutations in vector index keys, edge:
- Schema state not found for %s.
- illegal rune found "%c", expecting {
AI-assisted analysis of dgraph-io/dgraph@759e242be6 (2026-09-01).
Data as JSON: /api/errors/3ceda2d9054252a8.
Report an issue: GitHub.