HKUDS/DeepTutor · error · HTTPException

File not found

Error message

File not found

What it means

Error "File not found" thrown in HKUDS/DeepTutor.

Source

Thrown at deeptutor/api/routers/knowledge.py:2327

            return None
        raise HTTPException(
            status_code=409,
            detail=(
                f"Knowledge base '{resolved_name}' is connected to an external resource "
                "and has no local files."
            ),
        )

    kb_path = manager.get_knowledge_base_path(resolved_name)
    return kb_path / "raw"


def _resolve_kb_raw_file_or_404(kb_name: str, filename: str) -> Path:
    """Resolve a raw KB file while preventing traversal outside raw/."""
    raw_dir = _resolve_kb_raw_dir(kb_name)
    assert raw_dir is not None  # allow_unsupported=False guarantees a path
    if not raw_dir.exists():
        raise HTTPException(status_code=404, detail="File not found")

    raw_resolved = raw_dir.resolve()
    target = (raw_dir / filename).resolve()
    try:
        target.relative_to(raw_resolved)
    except ValueError:
        raise HTTPException(status_code=403, detail="Access denied")

    if not target.exists() or not target.is_file():
        raise HTTPException(status_code=404, detail="File not found")

    return target


@router.get("/{kb_name}/files")
async def list_kb_raw_files(kb_name: str):
    """List raw documents under <kb>/raw/, recursing into folders.

View on GitHub (pinned to 3e82f13042)

When it happens

Trigger: Thrown at deeptutor/api/routers/knowledge.py:2327 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/55d55e74aa967162. Report an issue: GitHub.