weaviate/weaviate · error

sparse search: %w

Error message

sparse search: %w

What it means

Wraps any error returned by the sparse (BM25 keyword) leg of hybrid search. processSparseSearch receives results, scores, and an error from the inverted-index search; if err is non-nil it is wrapped here and the whole hybrid query aborts. The sparse leg never ran to completion, so no fusion happens.

Source

Thrown at usecases/traverser/hybrid/searcher.go:211

			return nil, fmt.Errorf("hybrid search selection: %w", err)
		}
	}
	if postProc != nil {
		sr, err := postProc(fused)
		if err != nil {
			return nil, fmt.Errorf("hybrid search post-processing: %w", err)
		}
		fused = sr
	}
	if params.SelectionFn == nil && params.Autocut > 0 {
		fused = performAutocut(fused, params.Autocut)
	}
	return fused, nil
}

func processSparseSearch(results []*storobj.Object, scores []float32, err error) ([]*search.Result, error) {
	if err != nil {
		return nil, fmt.Errorf("sparse search: %w", err)
	}

	out := make([]*search.Result, len(results))
	for i, obj := range results {
		sr := obj.SearchResultWithScore(additional.Properties{}, scores[i])
		sr.SecondarySortValue = sr.Score
		out[i] = &sr
	}
	return out, nil
}

func processDenseSearch(ctx context.Context,
	denseSearch denseSearchFunc, params *Params, modules modulesProvider,
	schemaGetter uc.SchemaGetter, targetVectorParamHelper targetVectorParamHelper,
) ([]*search.Result, error) {
	query := params.Query
	vector := params.Vector
	if params.HybridSearch.NearTextParams != nil {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Read the wrapped root cause in server logs — it identifies the actual sparse-search failure.
  2. Check shard health (`/v1/nodes`) and confirm all shards of the collection are reachable and not read-only.
  3. If an index looks corrupted, restore from backup or reindex the collection.
  4. Retry the query; transient replication or timeout errors may self-heal.

Example fix

// check cluster shard status before retrying
curl http://localhost:8080/v1/nodes | jq '.[] | .shards[] | select(.status != "READY")'
// after: repair or reassign unhealthy shards, then re-run the hybrid query
Defensive patterns

Strategy: retry

Validate before calling

// health check before query
const nodes = await fetch("http://localhost:8080/v1/nodes").then(r => r.json());
const unhealthy = nodes.flatMap(n => n.shards).filter(s => s.status !== "READY");
if (unhealthy.length) throw new Error("shards not ready: " + unhealthy.map(s => s.name));

Try / catch

try {
  return await hybridQuery();
} catch (e) {
  if (String(e).includes("sparse search")) {
    await sleep(backoff); // transient shard/replication errors may self-heal
    return await hybridQuery();
  }
  throw e;
}

Prevention

When it happens

Trigger: BM25/inverted index lookup failure during hybrid search: corrupted or missing inverted index, shard unavailable/read-only, stopword/lexicon processing errors, or a timeout in the underlying keyword search.

Common situations: Shard replication issues after node failure; disk problems corrupting LSM inverted-index buckets; querying a collection while a rebalance/restore is in progress.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/87b3008372aad34e. Report an issue: GitHub.