{"record":{"id":"0256bbf7cbafeef9","repo":"odysseus-dev/odysseus","slug":"failed-to-apply-folder-assignments","errorCode":null,"errorMessage":"Failed to apply folder assignments","messagePattern":"Failed to apply folder assignments","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/session_routes.py","lineNumber":1313,"sourceCode":"        updated = 0\n        db = SessionLocal()\n        try:\n            for sid, folder_name in assignments.items():\n                db_session_q = db.query(DbSession).filter(DbSession.id == sid)\n                if user:\n                    db_session_q = db_session_q.filter(DbSession.owner == user)\n                elif not single_user_mode:\n                    db_session_q = db_session_q.filter(DbSession.owner == user)\n                db_session = db_session_q.first()\n                if db_session:\n                    db_session.folder = folder_name\n                    db_session.updated_at = utcnow_naive()\n                    updated += 1\n            db.commit()\n        except Exception as e:\n            db.rollback()\n            logger.error(f\"Auto-sort DB update failed: {e}\")\n            raise HTTPException(500, \"Failed to apply folder assignments\")\n        finally:\n            db.close()\n\n        # How many unfiled chats are left after this batch — the\n        # frontend uses this to decide whether to show \"Tidy more\" or\n        # \"All sorted!\" in the toast.\n        unfiled_remaining_after = max(0, unfiled_total - updated)\n        return {\n            \"status\": \"ok\",\n            \"folders\": list(folders.keys()),\n            \"updated\": updated,\n            \"deleted_empty\": deleted_empty,\n            \"deleted_throwaway\": deleted_throwaway,\n            \"unfiled_remaining\": unfiled_remaining_after,\n        }\n\n    @router.get(\"/session/{session_id}/context_info\")\n    async def get_context_info(request: Request, session_id: str):","sourceCodeStart":1295,"sourceCodeEnd":1331,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/session_routes.py#L1295-L1331","documentation":"Error \"Failed to apply folder assignments\" 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":["Retry applying the folder assignments; check server logs if it persists.","Verify the target folders exist before applying."],"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-15T17:31:12.345Z"}