# NousResearch/hermes-agent · Empty tool_calls array causing HTTP 400 errors

## Open now

- Nothing open on GitHub.

Multiple fixes targeting a bug where message sanitization produces empty tool_calls arrays that trigger HTTP 400 errors from APIs like DeepSeek and OpenAI. Approaches include dropping the key entirely after deduplication and scoping deduplication logic to the current turn.

## TL;DR

- 7 member(s): 0 open issue(s), 1 closed issue(s), 0 open PR(s), 2 merged PR(s), 4 PR(s) closed without merging.
- A fix was merged to main in PR #86654. Verify it addresses your case.
- **Recommended:** read PR #86654 (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: `resolved` · deciding PR(s): `pr-86654`. This is distinct from the fix status above. Weigh it yourself.

## How this cluster was grouped

- Link evidence (`STRUCTURAL_SPANNING`): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
- Pairwise link density `0.29`: 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

- #64335: Bug: sanitize_api_messages dedup pass writes tool_calls: \[\] — HTTP 400 on DeepSeek/OpenAI

## Prior & competing PRs

- **#86654: fix(agent): close the empty tool_calls 400 class at all three chokepoints (#83312, #77921)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `agent/agent_runtime_helpers.py`, `agent/transports/chat_completions.py`, `tests/agent/transports/test_chat_completions_empty_tool_calls.py`, `tests/run_agent/test_message_sequence_repair.py`
- **#88324: fix(agent): keep tool results when a server reuses one tool_call_id (#70724)**. merged to main · fix tier `verified`
  - maintainer direction: category `merged`; implication `superseded`
  - files: `agent/agent_runtime_helpers.py`, `tests/run_agent/test_message_sequence_repair.py`
- **#64345: fix(sanitize): drop tool_calls key when dedup removes all calls**. closed without merge
  - maintainer direction: category `merged_via`; implication `superseded`; refs `#86654`, `#77944`, `#72591`, `#86654`
- **#72619: fix: strip empty tool_calls before API calls to avoid HTTP 400**. closed without merge
  - maintainer direction: category `uncategorized`; implication `needs_llm`
- **#77377: fix(sanitize): drop tool_calls key when dedup removes all calls (fixes empty-array 400 class)**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `#86654`, `#86654`
- **#79221: fix(agent): scope tool_call_id dedup to current turn, not whole session**. closed without merge
  - maintainer direction: category `implemented_elsewhere`; implication `superseded`; refs `df68cc1c1ab6`, `#88324`, `#70734`, `#58327`

## Fix status

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