odysseus-dev/odysseus · error · HTTPException

Model cache path must not be a symlink

Error message

Model cache path must not be a symlink

What it means

Security guard in delete_model: the resolved model cache path is a symlink. A symlinked cache dir could point outside the cache root, letting a delete wipe arbitrary directories; the operation is aborted (this exact condition is asserted by test_delete_model_rejects_symlink_cache_dir).

Solutions

  1. Remove the symlink and use the real cache directory path.
  2. Do not link the model cache to locations outside the cache root.
Defensive patterns

Strategy: validation

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/b5d97181c648a44c. Report an issue: GitHub.

Appendix: source

Thrown at routes/embedding_routes.py:236

            raise HTTPException(400, "Model is currently downloading")

        try:
            from fastembed import TextEmbedding
        except ImportError:
            raise HTTPException(503, "fastembed is not installed")

        catalog = {m["model"]: m for m in TextEmbedding.list_supported_models()}
        if model_name not in catalog:
            raise HTTPException(404, f"Unknown model: {model_name}")

        hf_src = catalog[model_name].get("sources", {}).get("hf", "")
        if not hf_src:
            raise HTTPException(400, "No cache source for this model")

        try:
            model_path = _model_cache_path(hf_src)
        except ValueError as e:
            raise HTTPException(400, str(e))
        if not model_path.is_dir():
            return {"deleted": False, "message": "Model not cached"}

        shutil.rmtree(model_path)
        logger.info(f"Deleted cached model: {model_name} ({model_path})")
        return {"deleted": True, "model": model_name}

    @router.get("/endpoint")
    def get_endpoint():
        """Get the current custom embedding endpoint config."""
        saved = _load_custom_endpoint()
        current_url = os.environ.get("EMBEDDING_URL", "")
        return {
            "url": saved.get("url", current_url),
            "model": saved.get("model", os.environ.get("EMBEDDING_MODEL", "")),
            "active": bool(saved.get("url") or current_url),
        }

View on GitHub (pinned to f9235ebbf1)