valeriansaliou/sonic · critical · panic

flush_after for kv must be strictly lower than inactive_afte

Error message

flush_after for kv must be strictly lower than inactive_after

What it means

Config::validate() panics when the KV database's flush_after duration is greater than or equal to the pool's inactive_after duration. flush_after must be strictly lower, otherwise a buffer could never be flushed before the pool considers the instance inactive. It aborts startup.

Source

Thrown at core/src/config.rs:43

    pub tokenization: ConfigTokenization,

    pub stopwords: ConfigStopwords,

    pub search: ConfigSearch,

    pub store: ConfigStore,
}

impl Config {
    pub fn validate(&self) {
        // Check 'write_buffer' for KV
        if self.store.kv.database.write_buffer_size == Some(0) {
            panic!("write_buffer for kv must not be zero");
        }

        // Check 'flush_after' for KV
        if self.store.kv.database.flush_after >= self.store.kv.pool.inactive_after {
            panic!("flush_after for kv must be strictly lower than inactive_after");
        }

        // Check 'flush_after' for KV
        if self.store.kv.database.max_flushes.is_some()
            && self.store.kv.database.max_background_jobs.is_some()
        {
            panic!("max_background_jobs makes max_flushes unneeded, don’t configure both");
        }

        // Check 'consolidate_after' for FST
        if self.store.fst.graph.consolidate_after >= self.store.fst.pool.inactive_after {
            panic!("consolidate_after for fst must be strictly lower than inactive_after");
        }
    }
}

/// Configuration group for normalization options (Unicode normalization,
/// stemming, lemmatization…).

View on GitHub (pinned to e6a72da6a5)

Solutions

  1. Lower flush_after under [store.kv.database] so it is strictly less than inactive_after
  2. Raise inactive_after under [store.kv.pool] above flush_after
  3. Restart the server after fixing the config

Example fix

// config.toml
// before
[store.kv.database]
flush_after = 300
[store.kv.pool]
inactive_after = 300

// after
[store.kv.database]
flush_after = 60
[store.kv.pool]
inactive_after = 300
Defensive patterns

Strategy: validation

Validate before calling

assert!(
    cfg.store.kv.database.flush_after < cfg.store.kv.pool.inactive_after,
    "kv flush_after must be strictly lower than inactive_after"
);

Prevention

When it happens

Trigger: Configuring [store.kv.database] flush_after >= [store.kv.pool] inactive_after (e.g. flush_after = 300, inactive_after = 300, or inverted values) and starting the server.

Common situations: Tuning the KV write buffer: copying a flush_after value from another section, or raising flush_after without raising inactive_after; duration units mistakes (seconds vs milliseconds).

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 valeriansaliou/sonic@e6a72da6a5 (2026-09-01). Data as JSON: /api/errors/e216756f1e5a9d8b. Report an issue: GitHub.