Skip to content

[Bug]: 'Exception Event loop is closed' after vision_analyze used as first call to hermes in chat session/some chained tool calls #2104

@smt923

Description

@smt923

Bug Description

When opening the chat and using the first message of the clean session to paste an image and ask for analysis, the vision_analyze tool goes off, analyzes for a while then comes back with the result to hermes, but in this 'hand off' process from the image analysis tool back to hermes I get the below stack trace - if I press enter to continue it ends up outputting, but it seems confused by the system prompt 'mixing' with the image analysis or something because it said:

The system's already given you a
pretty thorough breakdown of what's in the image.

when I asked what it meant by that it seemed confused at what even happened:

You're right, my mistake — I misread the situation. There's no image attached to this
conversation and no system output showing any image analysis.

I'm getting confused by something in my context.

after that, during ongoing conversation, if i ask for another image to be analyzed it completes fine

Steps to Reproduce

  1. Run local model with image support
  2. Open hermes to a fresh session
  3. In the very first message, paste an image and ask for some kind of analysis
  4. Wait for analysis
  5. When it says image analyzed a second or so later it will dump the stacktrace

Expected Behavior

Image analysis completes and hermes replies cleanly

Actual Behavior

I get the Exception Event loop is closed stack trace below

Affected Component

Tools (terminal, file ops, web, code execution, etc.)

Messaging Platform (if gateway-related)

No response

Operating System

Arch Linux (6.19.7-1)

Python Version

3.11.15

Hermes Version

v0.4.0 (2026.3.18)

Relevant Logs / Traceback

Welcome to Hermes Agent! Type your message or /help for commands.

● what's this?

📎 1 image attached

  👁️  analyzing clip_20260319_225517_1.png (438KB)...
  ✓ image analyzed
────────────────────────────────────────


Unhandled exception in event loop:
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpx/_client.py", line 1985, in aclose
    await self._transport.aclose()
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 406, in aclose
    await self._pool.aclose()
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 353, in aclose
    await self._close_connections(closing_connections)
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 345, in _close_connections
    await connection.aclose()
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 173, in aclose
    await self._connection.aclose()
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpcore/_async/http11.py", line 258, in aclose
    await self._network_stream.aclose()
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 53, in aclose
    await self._stream.aclose()
  File "/home/smt/.hermes/hermes-agent/venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 1329, in aclose
    self._transport.close()
  File "/home/smt/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/asyncio/selector_events.py", line 864, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "/home/smt/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/asyncio/base_events.py", line 762, in call_soon
    self._check_closed()
  File "/home/smt/.local/share/uv/python/cpython-3.11.15-linux-x86_64-gnu/lib/python3.11/asyncio/base_events.py", line 520, in _check_closed
    raise RuntimeError('Event loop is closed')

Exception Event loop is closed

Root Cause Analysis (optional)

I don't know the exact cause, but I theorize its something to do with the first message, the tool returning and that being mixed in with the prompt, due to it saying the following:

The system's already given you a
pretty thorough breakdown of what's in the image.

when I asked what it meant by that it seemed confused at what even happened:

You're right, my mistake — I misread the situation. There's no image attached to this
conversation and no system output showing any image analysis.

I'm getting confused by something in my context.

or that's just unrelated noise and it's something to do with the async handling of the result returning to the main agent

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