{"record":{"id":"d4d87474cbc6dc28","repo":"odysseus-dev/odysseus","slug":"failed-to-add-directory-str-e","errorCode":null,"errorMessage":"Failed to add directory: {str(e)}","messagePattern":"Failed to add directory: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/personal_routes.py","lineNumber":232,"sourceCode":"                    personal_docs_manager.add_directory(directory, index=False)\n                    \n                    return {\n                        \"success\": True,\n                        \"message\": f\"Successfully indexed {result['indexed_count']} chunks from {directory}\",\n                        \"indexed_count\": result[\"indexed_count\"],\n                        \"failed_count\": result.get(\"failed_count\", 0),\n                        \"directory\": directory\n                    }\n                else:\n                    raise HTTPException(500, result.get(\"message\", \"Failed to index directory\"))\n            else:\n                raise HTTPException(503, \"RAG system is not available\")\n                \n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(f\"Error adding directory to RAG: {e}\")\n            raise HTTPException(500, f\"Failed to add directory: {str(e)}\")\n    \n    @router.delete(\"/remove_directory\")\n    async def remove_directory_from_rag(directory: str = Query(...), owner: str = Depends(require_user), _admin: None = Depends(require_admin)):\n        \"\"\"\n        Remove a directory from the RAG index.\n\n        Args:\n            directory: Path to the directory to remove\n\n        Returns:\n            JSON response confirming removal\n        \"\"\"\n        try:\n            # Confine to PERSONAL_DIR — parity with add_directory_to_rag (which\n            # resolves the path the same way). Without this, an arbitrary or\n            # `..`-escaping path is passed straight to\n            # personal_docs_manager.remove_directory / rag.remove_directory.\n            directory = _resolve_allowed_personal_dir(directory)","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/personal_routes.py#L214-L250","documentation":"Error \"Failed to add directory: {str(e)}\" 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":["Check server logs for the underlying error and retry.","Verify the directory is readable and inside the allowed root."],"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"}