hermes - 💡(How to fix) Fix [Bug]: AIAgent() got multiple values for keyword argument 'model' — reproduces on second turn of session

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…

Error Message

--- hermes dump --- version: 0.14.0 (2026.5.16) [68369874] — 152 commits behind upstream os: Darwin 24.6.0 arm64 python: 3.11.15 openai_sdk: 2.24.0 profile: default hermes_home: ~/.hermes model: claude-opus-4-7 provider: anthropic terminal: local

features:

toolsets: hermes-cli mcp_servers: 0 memory_provider: built-in gateway: running (manual, pid 49390) platforms: telegram cron_jobs: 0 skills: 91 config_overrides:

compression.threshold: 0.2 display.streaming: True Note: api_keys section showed all "not set" but Anthropic OAuth is the active auth path (Pro account). The crash log shows the gateway losing OAuth mid-session and falling back to openrouter, which is where the TypeError originates.

--- Reproduction pattern (from logs) ---

Session starts normally; first user turn completes successfully (API call returns 200). Between turn 1 and turn 2, gateway logs: "credential pool: no available entries (all exhausted or empty)" followed by "Primary provider auth failed: No Anthropic credentials found... — trying fallback" then "Fallback provider resolved: openrouter model=openai/gpt-5". On the next agent construction attempt, the TypeError fires: --- Crash trace (representative, occurred on 2026-05-16 20:56 and again 2026-05-17 10:35) ---

2026-05-17 10:35:10,537 ERROR gateway.platforms.api_server: Error running agent for chat completions: run_agent.AIAgent() got multiple values for keyword argument 'model' Traceback (most recent call last): File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 1223, in _handle_chat_completions result, usage = await _compute_completion() File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 1202, in _compute_completion return await self._run_agent(...) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 2757, in _run_agent return await loop.run_in_executor(None, _run) File ".../concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 2727, in _run agent = self._create_agent(...) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 859, in _create_agent agent = AIAgent(...) TypeError: run_agent.AIAgent() got multiple values for keyword argument 'model'

Same trace repeats on every subsequent turn of the affected session until the session is restarted. Confirmed twice (May 16 and May 17, second turn of each session).

Root Cause

Root Cause Analysis (optional)

Fix Action

Fix / Workaround

Workaround: Restart the session (start a new chat). First turn always works.

Code Example

--- hermes dump --- version: 0.14.0 (2026.5.16) [68369874]152 commits behind upstream os: Darwin 24.6.0 arm64 python: 3.11.15 openai_sdk: 2.24.0 profile: default hermes_home: ~/.hermes model: claude-opus-4-7 provider: anthropic terminal: local

features:

toolsets: hermes-cli
mcp_servers: 0
memory_provider: built-in
gateway: running (manual, pid 49390)
platforms: telegram
cron_jobs: 0
skills: 91
config_overrides:

compression.threshold: 0.2
display.streaming: True
Note: api_keys section showed all "not set" but Anthropic OAuth is the active auth path (Pro account). The crash log shows the gateway losing OAuth mid-session and falling back to openrouter, which is where the TypeError originates.

--- Reproduction pattern (from logs) ---

Session starts normally; first user turn completes successfully (API call returns 200).
Between turn 1 and turn 2, gateway logs: "credential pool: no available entries (all exhausted or empty)" followed by "Primary provider auth failed: No Anthropic credentials found... — trying fallback" then "Fallback provider resolved: openrouter model=openai/gpt-5".
On the next agent construction attempt, the TypeError fires:
--- Crash trace (representative, occurred on 2026-05-16 20:56 and again 2026-05-17 10:35) ---

2026-05-17 10:35:10,537 ERROR gateway.platforms.api_server: Error running agent for chat completions: run_agent.AIAgent() got multiple values for keyword argument 'model' Traceback (most recent call last): File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 1223, in _handle_chat_completions result, usage = await _compute_completion() File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 1202, in _compute_completion return await self._run_agent(...) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 2757, in _run_agent return await loop.run_in_executor(None, _run) File ".../concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 2727, in _run agent = self._create_agent(...) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 859, in _create_agent agent = AIAgent(...) TypeError: run_agent.AIAgent() got multiple values for keyword argument 'model'

Same trace repeats on every subsequent turn of the affected session until the session is restarted. Confirmed twice (May 16 and May 17, second turn of each session).

---
RAW_BUFFERClick to expand / collapse

Bug Description

Environment:

  • Hermes desktop app (hermes-agent), latest version as of 2026-05-16
  • macOS 15.7.5, Apple Silicon
  • Main model: claude-opus-4-7 (anthropic OAuth)
  • Compression aux: openrouter/anthropic/claude-3.5-haiku
  • Fallback: openrouter/openai/gpt-5

Steps to Reproduce

  1. Start a fresh chat session
  2. Session start emits warning: "Compression model context is 200,000 tokens, but threshold was 500,000 — auto-lowered to 200,000 this session"
  3. Send first user message — agent responds normally
  4. Send second user message — crashes with: Internal server error: run_agent.AIAgent() got multiple values for keyword argument 'model'

Frequency: Reproduced on consecutive days (May 16 and May 17), second turn each time.

Suspected cause: The compression-threshold auto-adjust at session start appears to inject a model override into agent construction state. On the second turn, another code path also passes model= to AIAgent(), causing the kwarg collision.

Workaround: Restart the session (start a new chat). First turn always works.

Impact: Forces session restart and loss of in-session context after one message. Particularly painful for long-running work (e.g., PRD editing across multiple turns).

Affected components (inferred): agent runtime (run_agent.AIAgent construction), compression subsystem (auto-threshold adjust at session start), and turn-to-turn agent state management. The error message points to run_agent.py as the crash site.

Expected Behavior

Second and subsequent user messages should be processed normally, with the agent continuing to use the configured main model (claude-opus-4-7) without raising a kwarg collision. Compression-threshold auto-adjust at session start should not interfere with downstream agent construction.

Actual Behavior

First turn responds normally. Second turn crashes with a Python TypeError surfaced as "Internal server error: run_agent.AIAgent() got multiple values for keyword argument 'model'". Once triggered, all subsequent turns in the session fail the same way. Only a session restart (new chat) or app restart clears it. In-session context is lost on restart.

Affected Component

Agent Core (conversation loop, context compression, memory)

Messaging Platform (if gateway-related)

Telegram

Debug Report

--- hermes dump --- version: 0.14.0 (2026.5.16) [68369874]152 commits behind upstream os: Darwin 24.6.0 arm64 python: 3.11.15 openai_sdk: 2.24.0 profile: default hermes_home: ~/.hermes model: claude-opus-4-7 provider: anthropic terminal: local

features:

toolsets: hermes-cli
mcp_servers: 0
memory_provider: built-in
gateway: running (manual, pid 49390)
platforms: telegram
cron_jobs: 0
skills: 91
config_overrides:

compression.threshold: 0.2
display.streaming: True
Note: api_keys section showed all "not set" but Anthropic OAuth is the active auth path (Pro account). The crash log shows the gateway losing OAuth mid-session and falling back to openrouter, which is where the TypeError originates.

--- Reproduction pattern (from logs) ---

Session starts normally; first user turn completes successfully (API call returns 200).
Between turn 1 and turn 2, gateway logs: "credential pool: no available entries (all exhausted or empty)" followed by "Primary provider auth failed: No Anthropic credentials found... — trying fallback" then "Fallback provider resolved: openrouter model=openai/gpt-5".
On the next agent construction attempt, the TypeError fires:
--- Crash trace (representative, occurred on 2026-05-16 20:56 and again 2026-05-17 10:35) ---

2026-05-17 10:35:10,537 ERROR gateway.platforms.api_server: Error running agent for chat completions: run_agent.AIAgent() got multiple values for keyword argument 'model' Traceback (most recent call last): File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 1223, in _handle_chat_completions result, usage = await _compute_completion() File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 1202, in _compute_completion return await self._run_agent(...) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 2757, in _run_agent return await loop.run_in_executor(None, _run) File ".../concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 2727, in _run agent = self._create_agent(...) File "/Users/troymaas/.hermes/hermes-agent/gateway/platforms/api_server.py", line 859, in _create_agent agent = AIAgent(...) TypeError: run_agent.AIAgent() got multiple values for keyword argument 'model'

Same trace repeats on every subsequent turn of the affected session until the session is restarted. Confirmed twice (May 16 and May 17, second turn of each session).

Operating System

MacOS 15.7.5, Apple Silicon

Python Version

3.13.7 (Homebrew install at /opt/homebrew/bin/python3)

Hermes Version

Hermes Agent v0.14.0 (2026.5.16) Project: /Users/troymaas/.hermes/hermes-agent Python: 3.11.15 OpenAI SDK

Additional Logs / Traceback (optional)

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

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…

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 - 💡(How to fix) Fix [Bug]: AIAgent() got multiple values for keyword argument 'model' — reproduces on second turn of session