OpenBMB/ChatDev · error · HTTPException
Session not found
Error message
Session not found
What it means
A session-scoped artifact endpoint looked up session_id in the websocket manager's session store and found no such session. All artifact routes delegate to _get_session_and_queue, which 404s when get_session returns falsy.
Source
Thrown at server/routes/artifacts.py:28
router = APIRouter()
MAX_FILE_SIZE = 20 * 1024 * 1024 # 20 MB
def _split_csv(value: Optional[str]) -> Optional[List[str]]:
if not value:
return None
parts = [part.strip() for part in value.split(",")]
filtered = [part for part in parts if part]
return filtered or None
def _get_session_and_queue(session_id: str):
manager = get_websocket_manager()
session = manager.session_store.get_session(session_id)
if not session:
raise HTTPException(status_code=404, detail="Session not found")
queue = session.artifact_queue
if queue is None:
raise HTTPException(status_code=404, detail="Artifact stream not available")
return manager, queue
@router.get("/api/sessions/{session_id}/artifact-events")
async def poll_artifact_events(
session_id: str,
wait_seconds: float = Query(25.0, ge=0.0, le=60.0),
after: Optional[int] = Query(None, ge=0),
include_mime: Optional[str] = Query(None),
include_ext: Optional[str] = Query(None),
max_size: Optional[int] = Query(None, gt=0),
limit: int = Query(25, ge=1, le=100),
):
manager, queue = _get_session_and_queue(session_id)
include_mime_list = _split_csv(include_mime)View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Verify the session still exists via the session listing API before polling artifacts
- Re-create/reconnect the session to get a fresh session_id
- Check for server restarts in logs that would clear in-memory sessions
- URL-encode the session_id exactly as returned at creation
Defensive patterns
Strategy: try-catch
Validate before calling
# call the session listing/detail API first assert session_id in client.list_sessions(), 'session missing'
Try / catch
try:
client.poll_artifact_events(session_id)
except HTTPError as e:
if e.response.status_code == 404 and e.response.json()['detail'] == 'Session not found':
session_id = client.create_session() # recover by recreating Prevention
- Handle 404 by recreating the session and re-running
- Persist session IDs only alongside server generation/uptime awareness
When it happens
Trigger: GET /api/sessions/{session_id}/artifact-events or GET /api/sessions/{session_id}/artifacts/{artifact_id} with a session_id that was never created, was removed, or belongs to a server that restarted and lost in-memory state.
Common situations: Server restart wiped the in-memory session store while the client kept an old session_id; typo in session_id; session already cleaned up/expired.
Related errors
- Artifact stream not available
- Artifact not found
- Artifact content unavailable
- Artifact file missing
- Session directory not found
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/aab88c83a1814bcc.
Report an issue: GitHub.