{"record":{"id":"7b75fa312973d596","repo":"valeriansaliou/sonic","slug":"max-background-jobs-makes-max-flushes-unneeded-do","errorCode":null,"errorMessage":"max_background_jobs makes max_flushes unneeded, don’t configure both","messagePattern":"max_background_jobs makes max_flushes unneeded, don’t configure both","errorType":"validation","errorClass":"panic","httpStatus":null,"severity":"critical","filePath":"core/src/config.rs","lineNumber":50,"sourceCode":"}\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…).\n#[derive(Deserialize, Clone, Copy)]\npub struct ConfigNormalization {\n    #[serde(with = \"crate::util::serde::none_string_as_none\")]\n    pub unicode_normalization: Option<UnicodeNormalization>,\n\n    pub diacritic_folding_enabled: bool,\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/valeriansaliou/sonic/blob/e6a72da6a532bc3f31d7d93ef1e0964a1a5d01b2/core/src/config.rs#L32-L68","documentation":"Config::validate() panics when both max_flushes and max_background_jobs are set for the KV database. max_background_jobs supersedes max_flushes, so specifying both is contradictory; only one may be configured.","triggerScenarios":"Setting both store.kv.database.max_flushes and store.kv.database.max_background_jobs (both Some(..)) in the config, then starting the server.","commonSituations":"Upgrading from an older Sonic config that used max_flushes and adding the newer max_background_jobs without removing the old key; copy-pasting a merged example config.","solutions":["Remove max_flushes from [store.kv.database] and keep max_background_jobs","Or remove max_background_jobs if you intend to keep legacy max_flushes tuning","Restart the server after fixing the config"],"exampleFix":"// config.toml\n// before\n[store.kv.database]\nmax_flushes = 4\nmax_background_jobs = 4\n\n// after\n[store.kv.database]\nmax_background_jobs = 4","handlingStrategy":"validation","validationCode":"let kv = &cfg.store.kv.database;\nif kv.max_flushes.is_some() && kv.max_background_jobs.is_some() {\n    return Err(\"configure max_background_jobs OR max_flushes, not both\".into());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate fully to max_background_jobs and delete max_flushes","Keep one canonical config template per Sonic version","Diff your config against the upstream example on upgrades"],"tags":["config","panic","kv","deprecated-option"],"backgroundTag":"conflicting-config-options","analyzedSha":"e6a72da6a532bc3f31d7d93ef1e0964a1a5d01b2","analyzedAt":"2026-09-01T14:10:00.384Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}