odysseus-dev/odysseus · error · HTTPException

Failed to add directory

Error message

Failed to add directory: {str(e)}

What it means

A 500 wrap-up in the directory-index flow: an exception escaped the indexing/tracking block (e.g. personal_docs_manager.add_directory failed or a non-HTTPException error occurred), so the endpoint re-raises it as 'Failed to add directory' with the original exception text appended.

Solutions

  1. Check server logs for the underlying error and retry.
  2. Verify the directory is readable and inside the allowed root.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: 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.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/d4d87474cbc6dc28. Report an issue: GitHub.

Appendix: source

Thrown at routes/personal_routes.py:232

                    personal_docs_manager.add_directory(directory, index=False)
                    
                    return {
                        "success": True,
                        "message": f"Successfully indexed {result['indexed_count']} chunks from {directory}",
                        "indexed_count": result["indexed_count"],
                        "failed_count": result.get("failed_count", 0),
                        "directory": directory
                    }
                else:
                    raise HTTPException(500, result.get("message", "Failed to index directory"))
            else:
                raise HTTPException(503, "RAG system is not available")
                
        except HTTPException:
            raise
        except Exception as e:
            logger.error(f"Error adding directory to RAG: {e}")
            raise HTTPException(500, f"Failed to add directory: {str(e)}")
    
    @router.delete("/remove_directory")
    async def remove_directory_from_rag(directory: str = Query(...), owner: str = Depends(require_user), _admin: None = Depends(require_admin)):
        """
        Remove a directory from the RAG index.

        Args:
            directory: Path to the directory to remove

        Returns:
            JSON response confirming removal
        """
        try:
            # Confine to PERSONAL_DIR — parity with add_directory_to_rag (which
            # resolves the path the same way). Without this, an arbitrary or
            # `..`-escaping path is passed straight to
            # personal_docs_manager.remove_directory / rag.remove_directory.
            directory = _resolve_allowed_personal_dir(directory)

View on GitHub (pinned to f9235ebbf1)