# NousResearch/hermes-agent · _build_api_kwargs crashes from None or unbound variables

## Open now

- Nothing open on GitHub.

Multiple bugs and fixes centered on NoneType and UnboundLocalError crashes in _build_api_kwargs, primarily caused by request_overrides being None and api_kwargs being referenced before assignment. A secondary theme involves false OAuth detection for third-party Anthropic providers.

## TL;DR

- 11 member(s): 0 open issue(s), 6 closed issue(s), 0 open PR(s), 1 merged PR(s), 4 PR(s) closed without merging.
- A fix was merged to main in PR #17032. Verify it addresses your case.
- **Recommended:** read PR #17032 (and any competing PRs below) before filing. Confirm the merged change covers your symptom.

## Maintainer resolution verdict

- Internal-tracker verdict over this cluster's issue members: `partially_resolved` · deciding PR(s): `pr-17032`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_PARTIAL`): some members are connected by structural evidence (shared changed files, or a closing/superseded reference); the rest are joined by an automated relevance judgement over their text.
- Members outside that structural core may belong to a different underlying problem.
- Pairwise link density `0.24`: the share of member pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. `1.00` means every pair is linked.

## Closed / duplicate issues

- #7215: \[Bug\]: \`AttributeError: 'NoneType' object has no attribute 'get'\` after fast mode commit
- #7236: Gateway sessions crash: request_overrides is None in _build_api_kwargs
- #7241: Bug: NoneType error in run_agent.py _build_api_kwargs
- #7259: \[Bug\]: AttributeError: 'NoneType' object has no attribute 'get' in _build_api_kwargs when service_tier is empty
- #7277: \[Bug\]: Gateway crashes on every message — request_overrides is None in _build_api_kwargs (v0.8.0)
- #7690: UnboundLocalError: api_kwargs not defined in max_retries_exhausted error handler

## Prior & competing PRs

- **#7353: fix: prevent false OAuth detection and gateway crashes for third-party Anthropic providers**. closed without merge · fix tier `suggested`
  - maintainer direction: category `uncategorized`; implication `needs_llm`
  - _suggested-tier fix detail withheld; re-request with `?tier=all` to include it._
- **#17032: fix(gateway): guard against None request_overrides in _build_api_kwargs**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `gateway/run.py`, `tests/gateway/test_fast_command.py`, `tests/run_agent/test_provider_parity.py`
- **#7305: fix(gateway): guard against None request_overrides in _build_api_kwargs**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#17032`
- **#7367: fix(agent): prevent false OAuth detection for third-party Anthropic providers**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#12846`, `#7393`
- **#8253: fix(api_server): support OpenAI content array format for images in chat completions**. closed without merge
  - maintainer direction: category `superseded_by_pr`; implication `superseded`; refs `#12969`

## Fix status

- Merged to main in PR #17032 (cited above). No release data is tracked. Verify downstream.
- Fix last verified (merged) `2026-04-28`.
- Subsystem: `agent`
