quickwit-oss/quickwit · error

Internal error: Got sort_value2, but no sort extractor

Error message

Internal error: Got sort_value2, but no sort extractor

What it means

When a leaf search response contains a second sort value (sort_value2) for search_after handling, the collector requires the corresponding second sort extractor (score_extractor.second) to exist. A response carrying sort_value2 without its extractor indicates the root and leaf disagree on the sort configuration, so the code panics as an internal error.

Source

Thrown at quickwit/quickwit-search/src/top_k_collector.rs:859

                .first
                .convert_to_u64_ff_val(search_after_sort_value, sort_order1)
            {
                sort_value = Some(new_value);
            } else {
                // Value is out of bounds, we ignore sort_value2 and disable the whole
                // search_after
                return None;
            }
        }
        let mut sort_value2 = None;
        if let Some(search_after_sort_value) = search_after
            .sort_value2
            .and_then(|sort_value2| sort_value2.sort_value)
        {
            let extractor = score_extractor
                .second
                .as_ref()
                .expect("Internal error: Got sort_value2, but no sort extractor");
            if let Some(new_value) =
                extractor.convert_to_u64_ff_val(search_after_sort_value, sort_order2)
            {
                sort_value2 = Some(new_value);
            }
        }
        Some(Self {
            sort_value,
            sort_value2,
            compare_on_equal: !search_after.split_id.is_empty(),
            doc_id: search_after.doc_id,
        })
    }
}

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Verify all cluster nodes run the same quickwit version
  2. Confirm the search request's second sort field resolves to a valid extractor (not score/mixed incorrectly)
  3. Reproduce with the exact query JSON and check sort field parsing in the root handler
  4. If it persists, capture the query and open a bug with the reproduction
Defensive patterns

Strategy: validation

Validate before calling

// Before issuing a two-sort search_after query, confirm both sort fields exist in the index mapping:
GET /_fields — verify "field1" and "field2" are indexed and sortable.

Type guard

fn has_second_extractor(hit: &PartialHit) -> bool {
    hit.sort_value2.is_some() // only build search_after when leaf returned extractor-consistent values
}

Prevention

When it happens

Trigger: A query with two sort fields where the leaf built sort values but the extractor tuple's second element is None; typically mismatched sort field resolution between root and leaf (e.g. sort field exists on leaf but wasn't set as extractor at root, or a tantivy/quickwit version skew).

Common situations: Elasticsearch-compatible search_after requests with two-level sorting; rolling upgrades where nodes run different quickwit versions and serialize sort metadata differently.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/4ea7fb40567ba6f5. Report an issue: GitHub.