{"record":{"id":"396ad771fd278f1c","repo":"sigoden/aichat","slug":"usage-set-key-value-if-value-is-null-unset","errorCode":null,"errorMessage":"Usage: .set <key> <value>. If value is null, unset key.","messagePattern":"Usage: \\.set <key> <value>\\. If value is null, unset key\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/mod.rs","lineNumber":632,"sourceCode":"            (\"macros_dir\", display_path(&Self::macros_dir())),\n            (\"functions_dir\", display_path(&Self::functions_dir())),\n            (\"messages_file\", display_path(&self.messages_file())),\n        ];\n        if let Ok((_, Some(log_path))) = Self::log_config(self.working_mode.is_serve()) {\n            items.push((\"log_path\", display_path(&log_path)));\n        }\n        let output = items\n            .iter()\n            .map(|(name, value)| format!(\"{name:<24}{value}\\n\"))\n            .collect::<Vec<String>>()\n            .join(\"\");\n        Ok(output)\n    }\n\n    pub fn update(config: &GlobalConfig, data: &str) -> Result<()> {\n        let parts: Vec<&str> = data.split_whitespace().collect();\n        if parts.len() != 2 {\n            bail!(\"Usage: .set <key> <value>. If value is null, unset key.\");\n        }\n        let key = parts[0];\n        let value = parts[1];\n        match key {\n            \"temperature\" => {\n                let value = parse_value(value)?;\n                config.write().set_temperature(value);\n            }\n            \"top_p\" => {\n                let value = parse_value(value)?;\n                config.write().set_top_p(value);\n            }\n            \"use_tools\" => {\n                let value = parse_value(value)?;\n                config.write().set_use_tools(value);\n            }\n            \"max_output_tokens\" => {\n                let value = parse_value(value)?;","sourceCodeStart":614,"sourceCodeEnd":650,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/config/mod.rs#L614-L650","documentation":"A usage-error guard in the .set config command handler: it fires when update() is called without the expected '<key> <value>' argument structure (missing key or missing value). It is a sentinel validation error describing the correct command syntax, not an underlying I/O or parse failure.","triggerScenarios":"Thrown at src/config/mod.rs:632 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply both a key and a value, e.g. .set model gpt-4","To remove a key, pass null as the value","Run the config help or .set with no arguments to see available keys"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}