tursodatabase/turso · error

index contains {} segment bytes, below requested minimum {};

Error message

index contains {} segment bytes, below requested minimum {}; increase documents or extra tokens

What it means

During FTS benchmark preparation, after indexing the corpus the tool checks that the resulting segment size meets the user-requested minimum (corpus.min_index_bytes). If the generated documents produced fewer index bytes than requested, the benchmark cannot measure memory at the requested scale, so it aborts. This is a configuration-vs-reality mismatch, not a bug in the indexer.

Source

Thrown at perf/memory/src/fts.rs:132

    pub id_sum: i64,
}

pub async fn run_fts(config: FtsConfig, observer: &mut dyn FtsObserver) -> Result<RunResult> {
    let workload = FtsWorkload::prepare(config, observer).await?;
    let result = workload.run(observer).await;
    workload.finish(observer);
    result
}

impl FtsWorkload {
    pub async fn prepare(config: FtsConfig, observer: &mut dyn FtsObserver) -> Result<Self> {
        config.validate()?;
        observer.on_phase(FtsPhase::Setup);
        let fixture =
            FtsFixture::create_in_mode(config.documents, config.mode, config.corpus).await?;
        let stats = fixture.index_stats(config.corpus.cache_pages)?;
        observer.on_index(&stats);
        ensure!(
            stats.segment_bytes >= config.corpus.min_index_bytes,
            "index contains {} segment bytes, below requested minimum {}; increase documents or extra tokens",
            stats.segment_bytes,
            config.corpus.min_index_bytes
        );
        observer.on_phase(FtsPhase::Open);
        let first = fixture.open().await?;
        let mut sessions = Vec::with_capacity(config.connections);
        for _ in 1..config.connections {
            sessions.push(QuerySession {
                conn: first._db.connect()?,
                _db: first._db.clone(),
            });
        }
        sessions.push(first);
        if let Some(pages) = config.corpus.cache_pages {
            for session in &sessions {
                session

View on GitHub (pinned to 492c4a71cd)

Solutions

  1. Increase config.documents so the indexed corpus produces at least min_index_bytes of segment data
  2. Add extra tokens to the document fixture to grow per-document index size
  3. Lower corpus.min_index_bytes to match what the current document count realistically produces

Example fix

// before
FtsConfig { documents: 500, corpus: CorpusConfig { min_index_bytes: 50_000_000, .. } }
// after
FtsConfig { documents: 50_000, corpus: CorpusConfig { min_index_bytes: 50_000_000, .. } }
Defensive patterns

Strategy: validation

Validate before calling

let stats = fixture.index_stats(cache_pages).await?;
if stats.segment_bytes < config.corpus.min_index_bytes {
    return Err(anyhow!("need >= {} segment bytes, got {}", config.corpus.min_index_bytes, stats.segment_bytes));
}

Prevention

When it happens

Trigger: Running the FTS memory benchmark with corpus.min_index_bytes set larger than the index produced by config.documents documents (plus any extra tokens). E.g. --min-index-bytes 50000000 with only a few hundred documents.

Common situations: Users raise min_index_bytes to benchmark larger working sets but forget to scale up the document count; changed corpus mode or tokenization produces smaller segments than before; copied a config from a different corpus shape.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of tursodatabase/turso@492c4a71cd (2026-09-13). Data as JSON: /api/errors/1417968a6ee28e64. Report an issue: GitHub.