From de197bd7cb85037b803d6236f1a7f7622b08f97d Mon Sep 17 00:00:00 2001 From: 0xbyt4 <35742124+0xbyt4@users.noreply.github.com> Date: Thu, 26 Feb 2026 23:35:00 +0300 Subject: [PATCH] fix(cli): prevent crash in save_config_value when model is a string load_cli_config() supports both string and dict formats for the model key (e.g. `model: "anthropic/claude-opus-4"`), but save_config_value() assumed all intermediate keys are dicts. When the config file used the string format, running `/model ` would crash with TypeError: 'str' object does not support item assignment. Add an isinstance check so non-dict values are replaced with a fresh dict before descending. --- cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli.py b/cli.py index 10d43ea7..188f15aa 100755 --- a/cli.py +++ b/cli.py @@ -708,7 +708,7 @@ def save_config_value(key_path: str, value: any) -> bool: keys = key_path.split('.') current = config for key in keys[:-1]: - if key not in current: + if key not in current or not isinstance(current[key], dict): current[key] = {} current = current[key] current[keys[-1]] = value