Skip to content

fix(tools_config): guard against None in known_plugin_toolsets config - #53196

Closed
17324393074 wants to merge 1 commit into
NousResearch:mainfrom
17324393074:fix/tools-config-known-plugin-null-guard
Closed

17324393074 wants to merge 1 commit into
NousResearch:mainfrom
17324393074:fix/tools-config-known-plugin-null-guard

Conversation

@17324393074

Copy link
Copy Markdown

Problem

When config.yaml has known_plugin_toolsets: null (or any value mapped to None by the YAML loader), config.get("known_plugin_toolsets", {}) returns None — because Python's dict.get only falls back to the default when the key is absent, not when its value is None.

The subsequent set(known_map.get(platform, [])) then crashes with TypeError: 'NoneType' object is not iterable, causing the gateway to fail to start and Hermes Desktop to show "Hermes couldn't start".

Fix

  • or {} to guard against known_map being None
  • or [] to guard against known_map.get(platform, []) returning None

How to reproduce

  1. Set known_plugin_toolsets: null or known_plugin_toolsets: (empty) in ~/.hermes/config.yaml
  2. Restart any process that calls _get_platform_tools (gateway, desktop, CLI)
  3. Observe TypeError: 'NoneType' object is not iterable

Testing

  • Verified that config.get("known_plugin_toolsets", {}) or {} returns {} when the value is None
  • Verified that set(known_map.get("windows", []) or []) returns set() when the key doesn't exist in the config

When config.yaml has known_plugin_toolsets set to null (or any value
mapped to None by the YAML loader), config.get returns None (dict.get
only falls back to the default when the key is absent, not when its
value is None). The subsequent set(known_map.get(platform, [])) then
crashes with TypeError: NoneType object is not iterable and the gateway
fails to start, even though no plugin toolsets are configured.

Add or-empty-dict and or-empty-list guards so a null/None value is
treated as empty instead of crashing the platform-tools resolver.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists labels Jun 26, 2026
teknium1 added a commit that referenced this pull request Jul 10, 2026
Sibling of the salvaged #53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
@teknium1

Copy link
Copy Markdown
Collaborator

Merged via PR #61835 — your commit was cherry-picked onto current main with authorship preserved in git history (df886d0). We also widened the same guard to the write path in the same module (setdefault() doesn't replace a present-but-null key, so saving platform tools crashed too). Thanks for the fix!

@teknium1 teknium1 closed this Jul 10, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
Sibling of the salvaged NousResearch#53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
justemu pushed a commit to justemu/hermes-agent that referenced this pull request Jul 18, 2026
justemu pushed a commit to justemu/hermes-agent that referenced this pull request Jul 18, 2026
Sibling of the salvaged NousResearch#53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
Sibling of the salvaged NousResearch#53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
Sibling of the salvaged NousResearch#53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
Sibling of the salvaged NousResearch#53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
melon-xf added a commit to melon-xf/hermes-agent that referenced this pull request Sep 3, 2026
Sibling of the salvaged NousResearch#53196 read-path fix: setdefault() does not
replace a present-but-null key, so saving platform tools with
known_plugin_toolsets: null in config.yaml crashed on indexing None.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants