{"record":{"id":"e216756f1e5a9d8b","repo":"valeriansaliou/sonic","slug":"flush-after-for-kv-must-be-strictly-lower-than-ina","errorCode":null,"errorMessage":"flush_after for kv must be strictly lower than inactive_after","messagePattern":"flush_after for kv must be strictly lower than inactive_after","errorType":"validation","errorClass":"panic","httpStatus":null,"severity":"critical","filePath":"core/src/config.rs","lineNumber":43,"sourceCode":"    pub tokenization: ConfigTokenization,\n\n    pub stopwords: ConfigStopwords,\n\n    pub search: ConfigSearch,\n\n    pub store: ConfigStore,\n}\n\nimpl Config {\n    pub fn validate(&self) {\n        // Check 'write_buffer' for KV\n        if self.store.kv.database.write_buffer_size == Some(0) {\n            panic!(\"write_buffer for kv must not be zero\");\n        }\n\n        // Check 'flush_after' for KV\n        if self.store.kv.database.flush_after >= self.store.kv.pool.inactive_after {\n            panic!(\"flush_after for kv must be strictly lower than inactive_after\");\n        }\n\n        // Check 'flush_after' for KV\n        if self.store.kv.database.max_flushes.is_some()\n            && self.store.kv.database.max_background_jobs.is_some()\n        {\n            panic!(\"max_background_jobs makes max_flushes unneeded, don’t configure both\");\n        }\n\n        // Check 'consolidate_after' for FST\n        if self.store.fst.graph.consolidate_after >= self.store.fst.pool.inactive_after {\n            panic!(\"consolidate_after for fst must be strictly lower than inactive_after\");\n        }\n    }\n}\n\n/// Configuration group for normalization options (Unicode normalization,\n/// stemming, lemmatization…).","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/valeriansaliou/sonic/blob/e6a72da6a532bc3f31d7d93ef1e0964a1a5d01b2/core/src/config.rs#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Lower flush_after under [store.kv.database] so it is strictly less than inactive_after","Raise inactive_after under [store.kv.pool] above flush_after","Restart the server after fixing the config"],"exampleFix":"// config.toml\n// before\n[store.kv.database]\nflush_after = 300\n[store.kv.pool]\ninactive_after = 300\n\n// after\n[store.kv.database]\nflush_after = 60\n[store.kv.pool]\ninactive_after = 300","handlingStrategy":"validation","validationCode":"assert!(\n    cfg.store.kv.database.flush_after < cfg.store.kv.pool.inactive_after,\n    \"kv flush_after must be strictly lower than inactive_after\"\n);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep flush_after well below inactive_after (e.g. < 1/4)","Document the invariant next to your config template","Lint TOML duration pairs KV/FST in CI"],"tags":["config","panic","kv","duration"],"backgroundTag":"invalid-config-value","analyzedSha":"e6a72da6a532bc3f31d7d93ef1e0964a1a5d01b2","analyzedAt":"2026-09-01T14:10:00.384Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}