Skip to content

fix: openclaw migration overwrites model config dict with string#3924

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
0xbyt4:fix/openclaw-model-migration
Mar 30, 2026
Merged

fix: openclaw migration overwrites model config dict with string#3924
teknium1 merged 1 commit intoNousResearch:mainfrom
0xbyt4:fix/openclaw-model-migration

Conversation

@0xbyt4
Copy link
Copy Markdown
Contributor

@0xbyt4 0xbyt4 commented Mar 30, 2026

Summary

migrate_model_config() writes config["model"] = model_str which replaces the entire model dict with a bare string. This causes 'str' object has no attribute 'get' on every prompt after migration.

Root cause

# Before (bug): overwrites dict with string
hermes_config["model"] = model_str

# config.yaml becomes:
# model: "anthropic/claude-sonnet-4"   <-- string, loses provider/base_url

# Any code doing model_cfg.get("default") crashes

Fix

Preserve existing model dict, only update the default key:

existing_model = hermes_config.get("model")
if isinstance(existing_model, dict):
    existing_model["default"] = model_str
else:
    hermes_config["model"] = {"default": model_str}

Edge cases tested

  • model is dict (normal) — updates default, preserves provider/base_url
  • model is string (already broken) — converts to dict
  • model key missing (fresh install) — creates dict
  • model is None — creates dict

Affected users

Multiple reports in Discord — all from users who migrated from OpenClaw. Reinstalling without migration was the only workaround.

migrate_model_config() was writing `config["model"] = model_str` which
replaces the entire model dict (default, provider, base_url) with a
bare string. This causes 'str' object has no attribute 'get' errors
throughout Hermes when any code does model_cfg.get("default").

Now preserves the existing model dict and only updates the "default"
key, keeping provider/base_url intact.
@teknium1 teknium1 merged commit 0b0c1b3 into NousResearch:main Mar 30, 2026
2 of 3 checks passed
itsXactlY pushed a commit to itsXactlY/hermes-agent that referenced this pull request Mar 30, 2026
…sResearch#3924)

migrate_model_config() was writing `config["model"] = model_str` which
replaces the entire model dict (default, provider, base_url) with a
bare string. This causes 'str' object has no attribute 'get' errors
throughout Hermes when any code does model_cfg.get("default").

Now preserves the existing model dict and only updates the "default"
key, keeping provider/base_url intact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants