OpenBMB/ChatDev · error · ValidationError
Session not connected
Error message
Session not connected
What it means
ensure_known_session raises ValidationError when session_id is empty/None before any session lookup — i.e. the caller never supplied a session identifier. Distinct from a non-empty unknown session, this is a malformed-request guard.
Source
Thrown at server/state.py:29
def init_state() -> None:
"""Ensure global singletons are ready for incoming requests."""
get_websocket_manager()
def get_websocket_manager() -> WebSocketManager:
global websocket_manager
if websocket_manager is None:
websocket_manager = WebSocketManager()
return websocket_manager
def ensure_known_session(session_id: str, *, require_connection: bool = False) -> WebSocketManager:
"""Return the WebSocket manager if the session is connected or known."""
manager = get_websocket_manager()
if not session_id:
raise ValidationError("Session not connected", details={"session_id": session_id})
if session_id in manager.active_connections:
return manager
if not require_connection and manager.session_store.has_session(session_id):
return manager
raise ValidationError("Session not connected", details={"session_id": session_id})
View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Capture and pass the session id returned at connection/register time
- Validate session_id is non-empty before calling session-scoped APIs
- Check for field-name mismatches in the request payload
Example fix
# before
result = execute_workflow(session_id=sid, ...) # sid may be ''
# after
if not sid:
raise ValueError("missing session_id; connect first")
result = execute_workflow(session_id=sid, ...) Defensive patterns
Strategy: validation
Validate before calling
if not session_id:
raise ValueError('session_id required — connect first') Type guard
def has_session_id(sid: str | None) -> bool:
return isinstance(sid, str) and bool(sid.strip()) Prevention
- Store session id immediately from handshake response
- Validate non-empty before every session-scoped call
- Check field naming (session_id vs sessionId)
When it happens
Trigger: Calling execute_workflow, execute_batch, upload_attachment, or list_attachments with session_id="" or None (missing query/body field, unset client variable).
Common situations: Client connects but never stores the session id from the handshake; field name mismatch (sessionId vs session_id); default empty string in a form.
Related errors
- Design file not found: {config_path}
- Artifact stream not available
- Invalid session_id: only letters, digits, underscores, and h
- No node types registered; cannot validate workflow
- Unsupported node type '{ntype}' for node '{nid}'. Only {allo
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/015e445443910a93.
Report an issue: GitHub.