Skip to content

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

Open
ms-alan wants to merge 1 commit into
NousResearch:mainfrom
ms-alan:fix/13721-platformconfig-null-homechannel
Open

fix(gateway): accept explicit null home_channel in PlatformConfig.from_dict (Closes #13721)#13791
ms-alan wants to merge 1 commit into
NousResearch:mainfrom
ms-alan:fix/13721-platformconfig-null-homechannel

Conversation

@ms-alan

@ms-alan ms-alan commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

PlatformConfig.from_dict() crashed with TypeError: 'NoneType' object is not subscriptable when a YAML config explicitly sets home_channel: null.

Root cause: The guard if "home_channel" in data is True for null values, so it passes None to HomeChannel.from_dict() which subscripts it like a dict.

Fix: Switch to if data.get("home_channel") is not None so explicit null is treated the same as an absent key.

Changes

  • gateway/config.py: one-line guard change in PlatformConfig.from_dict

Testing

YAML that previously crashed:

platforms:
  telegram:
    enabled: true
    home_channel: null

Closes #13721

…m_dict (Closes NousResearch#13721)

Use data.get('home_channel') is not None instead of 'home_channel' in data
so that YAML null values are treated the same as absent keys.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery area/config Config system, migrations, profiles labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #13721 — same root cause (home_channel: null crashes PlatformConfig.from_dict).

@trevorgordon981

Copy link
Copy Markdown

I have verified this solution by inspecting the code changes. The fix correctly handles explicit values for in by checking instead of just checking for key presence. This allows users to explicitly disable the home channel by setting it to in their YAML configuration without causing a crash. The fix ensures robust configuration parsing.\n\nTested and confirmed. ✅

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/gateway Gateway runner, session dispatch, delivery 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