{"record":{"id":"3f391f881e047bcc","repo":"Automattic/harper","slug":"forcestable-must-be-a-boolean-value","errorCode":null,"errorMessage":"ForceStable must be a boolean value.","messagePattern":"ForceStable must be a boolean value\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"harper-ls/src/config.rs","lineNumber":56,"sourceCode":"    /// Instructs `harper-ls` to place unstable code actions last.\n    /// In this case, \"unstable\" refers to their existence and action.\n    ///\n    /// For example, we always want to allow users to add \"misspelled\" elements\n    /// to dictionary, regardless of the spelling suggestions.\n    pub force_stable: bool,\n}\n\nimpl CodeActionConfig {\n    pub fn from_lsp_config(value: Value) -> Result<Self> {\n        let mut base = CodeActionConfig::default();\n\n        let Value::Object(value) = value else {\n            bail!(\"The code action configuration must be an object.\");\n        };\n\n        if let Some(force_stable_val) = value.get(\"ForceStable\") {\n            let Value::Bool(force_stable) = force_stable_val else {\n                bail!(\"ForceStable must be a boolean value.\");\n            };\n            base.force_stable = *force_stable;\n        };\n\n        Ok(base)\n    }\n}\n\n#[derive(Debug, Clone)]\npub struct Config {\n    pub user_dict_path: PathBuf,\n    pub file_dict_path: PathBuf,\n    pub workspace_dict_path: PathBuf,\n    pub ignored_lints_path: PathBuf,\n    pub stats_path: PathBuf,\n    pub lint_config: FlatConfig,\n    pub diagnostic_severity: DiagnosticSeverity,\n    pub code_action_config: CodeActionConfig,","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/Automattic/harper/blob/5fe7d5ab76492d83f3ecdbc3f1da83c75dcb6f83/harper-ls/src/config.rs#L38-L74","documentation":"Type-validation failure raised in CodeActionConfig::from_lsp_config when the \"ForceStable\" key in the submitted LSP configuration JSON exists but is not a JSON boolean (e.g. the string \"true\" or the number 1). from_lsp_config only reads ForceStable when the key is present, so this fires solely because of a malformed value type, not a missing key. The field controls whether harper-ls sorts unstable code actions (like dictionary additions) last. Fix: set \"ForceStable\" to true or false in the client's harper-ls settings, or remove the key to use the default.","triggerScenarios":"Sending codeAction settings containing `\"ForceStable\": \"true\"` (string), 1, or null to harper-ls via didChangeConfiguration/initialize options.","commonSituations":"Typing the setting without quotes-as-boolean in JSON (JSON has no bare true fallback when quoted), YAML/JSON5 configs where unquoted true got serialized as a string, editor plugins that pass settings through unvalidated.","solutions":["Change the value to a real JSON boolean: \"ForceStable\": true.","Remove the ForceStable key entirely to accept the default.","Check your editor's settings file for accidental string quoting around true/false."],"exampleFix":"// before\n\"codeAction\": { \"ForceStable\": \"true\" }\n// after\n\"codeAction\": { \"ForceStable\": true }","handlingStrategy":"validation","validationCode":"const forceStable = settings?.harperLs?.codeAction?.forceStable;\nif (forceStable !== undefined && typeof forceStable !== 'boolean') {\n  throw new TypeError('ForceStable must be a boolean');\n}","typeGuard":"fn is_bool(v: &serde_json::Value) -> bool { v.is_boolean() }","tryCatchPattern":"match CodeActionConfig::from_lsp_config(value) {\n    Ok(cfg) => cfg,\n    Err(e) => { log::warn!(\"bad codeAction config: {e}\"); CodeActionConfig::default() }\n}","preventionTips":["Write booleans unquoted in JSON settings (true, not \"true\").","Use editor setting definitions with a boolean type so the UI enforces the type.","Validate settings payloads before sending them to the server."],"tags":["rust","lsp","configuration","json"],"backgroundTag":"invalid-config-value","analyzedSha":"5fe7d5ab76492d83f3ecdbc3f1da83c75dcb6f83","analyzedAt":"2026-09-06T11:34:38.610Z","contentChangedAt":"2026-09-06T11:34:38.610Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}