Skip to content

Multiple unprotected .map() calls on session data causing runtime errors and "Failed to load sessions" #665

Description

Environment

  • Hermes Agent: v0.17.x
  • Hermes Workspace: Latest (Docker)
  • Setup: Docker Compose + Traefik on Linux VPS (Hostinger)

Problem

When using Hermes Workspace, the following errors appear frequently:

  • Cannot read properties of undefined (reading 'map')
  • NotFoundError: Failed to execute 'insertBefore' on 'Node'
  • "Failed to load sessions" in the sidebar and UI components

Verified Facts

  • /api/sessions returns HTTP 200 with valid JSON.
  • One specific unprotected .map() location (usage.sessions) was patched in /app/dist/server/assets/router-DxziTUUJ.js. The patch was successfully applied and verified, but the errors persisted.
  • Multiple other locations in the same bundle file execute .map() and .length directly on sessions, sessions2, and usage.sessions without defensive checks.
  • Backend communication, database integrity (state.db), and environment variables have been ruled out.

Steps to Reproduce

  1. Deploy Hermes Workspace via Docker Compose.
  2. Open the application.
  3. Interact with any UI that displays session lists (sidebar, chat panel, sessions drawer).
  4. The errors appear during rendering.

Expected Behavior

Session lists should render without JavaScript errors when valid data is returned by the API.

Actual Behavior

The frontend crashes when trying to iterate over session data that is undefined in some render paths, causing both TypeErrors and React DOM reconciliation failures.

What Was Already Tried

A minimal, reversible patch was applied to one of the unprotected .map() calls. While the patch was confirmed to be in place, the issue remained, indicating multiple unprotected call sites exist in the frontend bundle.

Conclusion

The root cause appears to be in the Hermes Workspace frontend. Several components render session data without sufficient null/undefined guards before calling array methods.

Request to Maintainers
The backend and Agent communication have been thoroughly verified. The problem seems isolated to the frontend bundle of Hermes Workspace. Adding defensive checks (or ensuring session data is always normalized before rendering) in the relevant components would likely resolve the issue.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions