{"record":{"id":"6d85b7148b6564de","repo":"zed-industries/zed","slug":"auto-compact-threshold-percentage-must-be-between","errorCode":null,"errorMessage":"auto_compact threshold percentage must be between 0% and 100%, got {raw:?}","messagePattern":"auto_compact threshold percentage must be between 0% and 100%, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent_settings/src/agent_settings.rs","lineNumber":182,"sourceCode":"            Self::TokensRemaining(tokens) => write!(formatter, \"-{tokens}\"),\n        }\n    }\n}\n\n#[derive(Clone, Copy, Debug, PartialEq)]\npub struct AutoCompactSettings {\n    pub enabled: bool,\n    pub threshold: AutoCompactThreshold,\n}\n\nfn parse_auto_compact_threshold(raw: &str) -> anyhow::Result<AutoCompactThreshold> {\n    let trimmed = raw.trim();\n    if let Some(percent) = trimmed.strip_suffix('%') {\n        let value: f64 = percent\n            .trim_end()\n            .parse()\n            .with_context(|| format!(\"invalid auto_compact threshold percentage {raw:?}\"))?;\n        anyhow::ensure!(\n            value > 0.0 && value <= 100.0,\n            \"auto_compact threshold percentage must be between 0% and 100%, got {raw:?}\"\n        );\n        Ok(AutoCompactThreshold::Percentage(value / 100.0))\n    } else {\n        let tokens: i64 = trimmed.parse().with_context(|| {\n            format!(\n                \"invalid auto_compact threshold {raw:?}; \\\n                 expected a percentage like \\\"90%\\\" or an integer number of tokens\"\n            )\n        })?;\n        match tokens.cmp(&0) {\n            Greater => Ok(AutoCompactThreshold::TokensUsed(tokens as u64)),\n            Less => Ok(AutoCompactThreshold::TokensRemaining(tokens.unsigned_abs())),\n            Equal => {\n                anyhow::bail!(\"auto_compact threshold of 0 is not valid\")\n            }\n        }","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent_settings/src/agent_settings.rs#L164-L200","documentation":"Error \"auto_compact threshold percentage must be between 0% and 100%, got {raw:?}\" thrown in zed-industries/zed.","triggerScenarios":"Thrown at crates/agent_settings/src/agent_settings.rs:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}