hermes - 💡(How to fix) Fix _priority_key raises ValueError: not enough values to unpack (expected 5, got 2)

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

ValueError: not enough values to unpack (expected 5, got 2)

Root Cause

_execute_tool_calls_concurrent() builds:

indexed_results = list(enumerate(zip(parsed_calls, results)))

Each element has shape (idx, (parsed_5tuple, result_6tuple)) — outer idx + a 2-element pair.

The _priority_key inner function at line ~10089 tries to unpack item[1] directly as the 5-element parsed_call tuple:

idx, (tc, name, args, block_result, blocked_by_guardrail) = item

But item[1] is (parsed_5tuple, result_6tuple) — a 2-element tuple. This raises:

ValueError: not enough values to unpack (expected 5, got 2)

Fix Action

Fix

# Before (broken)
idx, (tc, name, args, block_result, blocked_by_guardrail) = item

# After (fixed)
idx, (parsed_call, _) = item
_, name, _, _, _ = parsed_call

Code Example

indexed_results = list(enumerate(zip(parsed_calls, results)))

---

idx, (tc, name, args, block_result, blocked_by_guardrail) = item

---

ValueError: not enough values to unpack (expected 5, got 2)

---

# Before (broken)
idx, (tc, name, args, block_result, blocked_by_guardrail) = item

# After (fixed)
idx, (parsed_call, _) = item
_, name, _, _, _ = parsed_call
RAW_BUFFERClick to expand / collapse

Bug Description

_priority_key in _execute_tool_calls_concurrent() unpacks the wrong structure, causing an intermittent ValueError.

Root Cause

_execute_tool_calls_concurrent() builds:

indexed_results = list(enumerate(zip(parsed_calls, results)))

Each element has shape (idx, (parsed_5tuple, result_6tuple)) — outer idx + a 2-element pair.

The _priority_key inner function at line ~10089 tries to unpack item[1] directly as the 5-element parsed_call tuple:

idx, (tc, name, args, block_result, blocked_by_guardrail) = item

But item[1] is (parsed_5tuple, result_6tuple) — a 2-element tuple. This raises:

ValueError: not enough values to unpack (expected 5, got 2)

Fix

# Before (broken)
idx, (tc, name, args, block_result, blocked_by_guardrail) = item

# After (fixed)
idx, (parsed_call, _) = item
_, name, _, _, _ = parsed_call

Trigger Condition

Only fires when multiple tool calls run concurrently (the _execute_tool_calls_concurrent path) AND results exist for priority sorting. Single-tool batches or the sequential path are unaffected — explains the intermittent appearance.

Reproduction

Run any query that triggers 2+ concurrent tool calls (e.g. MCP search tools, parallel file reads). The error surfaces at the first tool batch entering the sorting path.

Affected Providers

All providers — this is generic Hermes code, not provider-specific.

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