{"record":{"id":"1dd1f4b31e9e650c","repo":"odysseus-dev/odysseus","slug":"session-has-an-active-run-try-compacting-after-it","errorCode":null,"errorMessage":"Session has an active run; try compacting after it finishes","messagePattern":"Session has an active run; try compacting after it finishes","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"routes/session_routes.py","lineNumber":94,"sourceCode":"    else:\n        content = getattr(message, \"content\", None)\n    return _content_to_text(content)\n\n\ndef _message_metadata(message) -> dict:\n    if isinstance(message, ChatMessage):\n        metadata = message.metadata\n    elif isinstance(message, dict):\n        metadata = message.get(\"metadata\")\n    else:\n        metadata = getattr(message, \"metadata\", None)\n    return metadata if isinstance(metadata, dict) else {}\n\n\ndef _reject_compact_during_active_run(session_id: str) -> None:\n    from src import agent_runs\n    if agent_runs.is_active(session_id):\n        raise HTTPException(409, \"Session has an active run; try compacting after it finishes\")\n\n\ndef _verify_session_owner(request: Request, session_id: str, session_manager=None):\n    \"\"\"Verify the current user owns the session, honoring single-user modes.\n\n    Authenticated requests must match the stored DB or in-memory owner. When\n    auth is disabled and no user is present, treat the app as single-user mode:\n    verify that the session exists, but do not compare its stored owner. This\n    keeps QA/dev instances with AUTH_ENABLED=false from rejecting owner-stamped\n    rows created while auth was previously enabled.\n    \"\"\"\n    user = effective_user(request)\n    if not user and not _auth_disabled():\n        raise HTTPException(401, \"Authentication required\")\n    db = SessionLocal()\n    try:\n        row = db.query(DbSession.owner).filter(DbSession.id == session_id).first()\n    finally:","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/session_routes.py#L76-L112","documentation":"Error \"Session has an active run; try compacting after it finishes\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Wait for the active run to finish, then compact.","Stop the running generation first if compaction is urgent."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}