{"record":{"id":"aa30592bc6be51cb","repo":"odysseus-dev/odysseus","slug":"directory-must-be-inside-personal-documents","errorCode":null,"errorMessage":"Directory must be inside personal documents","messagePattern":"Directory must be inside personal documents","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"routes/personal_routes.py","lineNumber":164,"sourceCode":"        return get_rag_manager()\n\n    def _resolve_allowed_personal_dir(directory: str) -> str:\n        \"\"\"Resolve a user-supplied personal-docs path under the allowed root.\"\"\"\n        if not directory:\n            raise HTTPException(400, \"Directory path is required\")\n\n        # realpath (not abspath) so a symlink inside PERSONAL_DIR that points\n        # outside it is resolved before the commonpath confinement check below;\n        # abspath only normalises `..` and would let such a symlink escape.\n        base_abs = os.path.realpath(PERSONAL_DIR)\n        candidate = directory if os.path.isabs(directory) else os.path.join(base_abs, directory)\n        resolved = os.path.realpath(candidate)\n        try:\n            in_base = os.path.commonpath([resolved, base_abs]) == base_abs\n        except ValueError:\n            in_base = False\n        if not in_base:\n            raise HTTPException(403, \"Directory must be inside personal documents\")\n        return resolved\n    \n    @router.get(\"\")\n    def api_personal_list(owner: str = Depends(require_user), _admin: None = Depends(require_admin)):\n        \"\"\"Enhanced version that includes directories\"\"\"\n        files = [{\"name\": f[\"name\"], \"size\": f[\"size\"], \"path\": f.get(\"path\", \"\")} for f in personal_docs_manager.index]\n        directories = personal_docs_manager.get_indexed_directories() if hasattr(personal_docs_manager, \"get_indexed_directories\") else []\n        return {\"files\": files, \"directories\": directories}\n    \n    @router.post(\"/reload\")\n    def api_personal_reload(owner: str = Depends(require_user), _admin: None = Depends(require_admin)):\n        personal_docs_manager.refresh_index()\n        return {\"ok\": True, \"count\": len(personal_docs_manager.index)}\n    \n    @router.post(\"/add_directory\")\n    async def add_directory_to_rag(\n        request: Request,\n        directory_request: DirectoryRequest,","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/personal_routes.py#L146-L182","documentation":"Error \"Directory must be inside personal documents\" 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":["Choose a directory located under the personal documents root.","Move the folder into personal documents, then index it."],"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"}