HKUDS/DeepTutor · error · HTTPException
Both name and folder_path are required.
Error message
Both name and folder_path are required.
What it means
Input-validation guard in POST /connect-folder: after stripping, either name or folder_path is empty. Both are required to register the read-only 'linked' KB pointer; the server will re-probe the folder itself, but only once both inputs are present.
Solutions
- Provide both a non-empty name and folder_path
- Trim whitespace from both values
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at deeptutor/api/routers/knowledge.py:1815 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/42ad81ddf32e3d93.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/knowledge.py:1815
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
result = probe_linked_folder(str(folder), payload.rag_provider)
return result.to_dict()
@router.post("/connect-folder")
async def connect_linked_folder_route(payload: ConnectFolderRequest):
"""Mount an existing engine index as a read-only ``linked`` knowledge base.
Re-probes server-side (never trusts the client's verdict), then registers a
pointer to the folder. Retrieval reads the index in place — no copy, no
re-index. Embedding-mismatch warnings do not block the link (the user may
switch embedding models later); a missing/invalid index does.
"""
name = (payload.name or "").strip()
folder_path = (payload.folder_path or "").strip()
if not name or not folder_path:
raise HTTPException(status_code=400, detail="Both name and folder_path are required.")
try:
folder = assert_path_allowed(folder_path)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
result = probe_linked_folder(str(folder), payload.rag_provider)
if not result.ok:
raise HTTPException(status_code=400, detail=result.error or "Folder is not linkable.")
stats = {
"embedding_model": result.embedding.index_model,
"doc_count": result.doc_count,
}
try:
manager = get_kb_manager()
entry = manager.register_linked_kb(
name,
str(folder),View on GitHub (pinned to 3e82f13042)