Skip to content

[Bug]: Gateway crashes on every message — request_overrides is None in _build_api_kwargs (v0.8.0) #7277

@muczynski-persefoni

Description

@muczynski-persefoni

Bug Description

Environment

  • Hermes Agent v0.8.0 (2026.4.8)
  • Deployment: Docker container, gateway mode
  • Platform: Slack
  • Provider: Anthropic (claude-opus-4-6)

Bug Description
Every message sent through the Slack gateway fails with AttributeError.
The agent never responds. /reset does not fix it.

Error
File "/opt/hermes/run_agent.py", line 7629, in run_conversation
api_kwargs = self._build_api_kwargs(api_messages)
File "/opt/hermes/run_agent.py", line 5522, in _build_api_kwargs
fast_mode=self.request_overrides.get("speed") == "fast",
^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'

During handling of the above exception, another exception occurred:
UnboundLocalError: cannot access local variable 'api_kwargs'
where it is not associated with a value

Root Cause
self.request_overrides is None when _build_api_kwargs is called via
the gateway code path (gateway/run.py → run_sync → run_conversation).
The safe initializer at line 678 (self.request_overrides = dict(request_overrides or {}))
is not being reached when the gateway creates/reuses agent instances.

This does not affect CLI mode — only gateway deployments.

Workaround
Patch line 5522 in run_agent.py:

Before:
fast_mode=self.request_overrides.get("speed") == "fast",

After:
fast_mode=(self.request_overrides or {}).get("speed") == "fast",

Then delete cached .pyc and restart the container.

Steps to Reproduce

  1. Deploy v0.8.0 in Docker gateway mode
  2. Connect any messaging platform (Slack, Telegram, etc.)
  3. Send any message
  4. Observe crash on every attempt

Expected Behavior

Gateway receives the message, _build_api_kwargs initializes successfully
with request_overrides as an empty dict {}, and the agent responds normally.

Actual Behavior

request_overrides is None instead of {}, causing _build_api_kwargs to
crash before any API call is made. The gateway returns an error on every
message with no fallback.

Affected Component

Other

Messaging Platform (if gateway-related)

No response

Operating System

  • OS: Linux (Debian 13.4, Docker container)

Python Version

  • Python: 3.13.5

Hermes Version

  • Hermes Agent: v0.8.0 (2026.4.8)

Relevant Logs / Traceback

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions