Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#7949·hermes-webui

Public share creation 500s on a conversation with a >4 KB inline image (ENAMETOOLONG in _resolve_against_roots)

Author: nesquena-hermesCreated Oct 1, 2026Updated Oct 1, 2026
Labelsbug

Summary

Creating a public share fails with a 500 for any conversation that contains an inline image (MEDIA:data:image/...;base64,...) whose data URI is longer than ~4 KB.

Reproduction (current master e33da25c6, exp-v0.52.392)

Call api.shares.build_share_snapshot() on a session with one assistant message Here: MEDIA:data:image/png;base64,<N bytes>:

payload bytes result
200 ok
5 000 OSError: [Errno 36] File name too long
60 000 OSError: [Errno 36] File name too long

Traceback tail: shares.py:342 _embed_share_media → shares.py:298 _replace_ref → shares.py:288 _resolve_against_roots.

Root cause

_resolve_against_roots() treats every MEDIA: ref as a candidate workspace path, including data: URIs. Its try only wraps (root / raw).resolve(strict=False). The next line, candidate.is_file(), calls stat() on the whole data URI as a filename. Once that exceeds the OS name limit, it raises ENAMETOOLONG outside the try. create_or_refresh_share() lets it propagate, and /api/share/create (api/routes.py ~15877) only catches ValueError, so the request 500s.

Introduced with the path allow-list hardening in #6174 (02b5f885c). It isn't specific to any open PR; I found it while gating #7868, which touches the same module.

Fix shape

  • Skip data: (and other non-path) refs before _resolve_against_roots does any filesystem resolution. The public-share classifier already decides those separately.
  • And/or wrap is_file() in the same except (OSError, ValueError, RuntimeError): continue.
  • Add a regression test with a >4 KB data URI, covering both build_share_snapshot and POST /api/share/create.

Source: nesquena/hermes-webui

View original on GitHubView discussion on GitHub