hermes - ✅(Solved) Fix Bug: gateway config loading crashes on explicit home_channel: null [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#13708Fetched 2026-04-22 08:04:32
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

PlatformConfig.from_dict() crashes when home_channel is explicitly present but set to null. That makes load_gateway_config() fail on otherwise reasonable YAML like:

platforms:
  telegram:
    enabled: true
    home_channel: null

Error Message

TypeError: 'NoneType' object is not subscriptable

Root Cause

PlatformConfig.from_dict() crashes when home_channel is explicitly present but set to null. That makes load_gateway_config() fail on otherwise reasonable YAML like:

platforms:
  telegram:
    enabled: true
    home_channel: null

Fix Action

Fixed

PR fix notes

PR #13721: fix(gateway): accept explicit null home_channel in PlatformConfig.from_dict

Description (problem / solution / changelog)

Summary

Fixes #13708. PlatformConfig.from_dict() crashes on the common YAML pattern of explicitly clearing an optional nested section with null:

```yaml platforms: telegram: enabled: true home_channel: null ```

Current code only checks for key-presence (`if "home_channel" in data`) and then unconditionally passes the value into `HomeChannel.from_dict()`, which subscripts it like a dict and raises `TypeError: 'NoneType' object is not subscriptable`.

Fix

One-line guard change: switch to `data.get("home_channel") is not None` so explicit `null` is treated the same as absent.

Test

Added a regression test covering the explicit-null YAML shape. All 28 tests in `tests/gateway/test_config.py` pass locally.

Scope

Pure bug-fix, purely additive semantics. No behavior change for existing callers (a dict home_channel still round-trips identically; missing home_channel still yields `None`). I audited all production and test callers of `PlatformConfig.from_dict()` — only one production call site in the same file at L384 (`load_gateway_config`) and 5 test sites; none pass `None` today so existing contract is preserved.

Closes #13708.

Changed files

  • gateway/config.py (modified, +4/-3)
  • tests/gateway/test_config.py (modified, +8/-0)

Code Example

platforms:
  telegram:
    enabled: true
    home_channel: null

---

from gateway.config import PlatformConfig
PlatformConfig.from_dict({"enabled": True, "home_channel": None})

---

TypeError: 'NoneType' object is not subscriptable

---

import os, pathlib, tempfile, textwrap
from gateway.config import load_gateway_config

with tempfile.TemporaryDirectory() as td:
    os.environ["HERMES_HOME"] = td
    pathlib.Path(td, "config.yaml").write_text(textwrap.dedent('''\
platforms:
  telegram:
    enabled: true
    home_channel: null
'''))
    load_gateway_config()
RAW_BUFFERClick to expand / collapse

Summary

PlatformConfig.from_dict() crashes when home_channel is explicitly present but set to null. That makes load_gateway_config() fail on otherwise reasonable YAML like:

platforms:
  telegram:
    enabled: true
    home_channel: null

Affected code

  • gateway/config.py:173-185
  • especially gateway/config.py:175-177

Why this is a bug

YAML null is a common way to clear an optional nested config section. The code checks only whether the key exists, then blindly passes None into HomeChannel.from_dict(), which subscripts it like a dict.

Minimal reproduction

from gateway.config import PlatformConfig
PlatformConfig.from_dict({"enabled": True, "home_channel": None})

Actual exception:

TypeError: 'NoneType' object is not subscriptable

End-to-end repro:

import os, pathlib, tempfile, textwrap
from gateway.config import load_gateway_config

with tempfile.TemporaryDirectory() as td:
    os.environ["HERMES_HOME"] = td
    pathlib.Path(td, "config.yaml").write_text(textwrap.dedent('''\
platforms:
  telegram:
    enabled: true
    home_channel: null
'''))
    load_gateway_config()

Expected behavior

  • home_channel: null should be treated the same as an absent home channel.

Actual behavior

  • Config loading crashes with TypeError: 'NoneType' object is not subscriptable.

Suggested investigation

Guard PlatformConfig.from_dict() with if data.get("home_channel") is not None: before calling HomeChannel.from_dict(), and add a regression test for explicit null home channels in YAML.

extent analysis

TL;DR

The most likely fix is to add a null check in PlatformConfig.from_dict() before calling HomeChannel.from_dict() to handle the case where home_channel is explicitly set to null in the YAML configuration.

Guidance

  • Investigate the PlatformConfig.from_dict() method and add a conditional check to handle the case where home_channel is None, as suggested in the issue.
  • Verify that the fix works by running the provided end-to-end reproduction code with the modified PlatformConfig.from_dict() method.
  • Consider adding a regression test to ensure that explicit null home channels in YAML are handled correctly.
  • Review the HomeChannel.from_dict() method to ensure it can handle the case where home_channel is None or missing.

Example

def from_dict(data):
    # ...
    if data.get("home_channel") is not None:
        home_channel = HomeChannel.from_dict(data["home_channel"])
    else:
        home_channel = None
    # ...

Notes

This fix assumes that the desired behavior is to treat an explicit null home channel the same as an absent home channel. If this is not the case, additional modifications may be necessary.

Recommendation

Apply the suggested workaround by adding a null check in PlatformConfig.from_dict() to handle the case where home_channel is explicitly set to null in the YAML configuration. This will prevent the TypeError and allow the configuration to load correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • home_channel: null should be treated the same as an absent home channel.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Bug: gateway config loading crashes on explicit home_channel: null [1 pull requests, 1 participants]