HKUDS/DeepTutor · warning · HTTPException
Both name and server_url are required.
Error message
Both name and server_url are required.
What it means
HTTP 400 from the LightRAG connect endpoint when either name or server_url is empty after stripping. Both fields are mandatory because the connection entry is keyed by name and must point at a reachable server URL.
Source
Thrown at deeptutor/api/routers/knowledge.py:1896
result = await probe_server(server_url, payload.api_key or "")
return result.to_dict()
@router.post("/connect-lightrag-server")
async def connect_lightrag_server_route(payload: ConnectLightRagServerRequest):
"""Connect an external LightRAG server as a retrieval-only knowledge base.
Re-probes server-side (never trusts the client's verdict), then registers a
pointer (``type: lightrag_server``). Retrieval is offloaded to the server's
``/query`` endpoint — no copy, no local index.
"""
from deeptutor.services.rag.pipelines.lightrag_server.config import SUPPORTED_MODES
from deeptutor.services.rag.pipelines.lightrag_server.probe import probe_server
name = (payload.name or "").strip()
server_url = (payload.server_url or "").strip()
if not name or not server_url:
raise HTTPException(status_code=400, detail="Both name and server_url are required.")
result = await probe_server(server_url, payload.api_key or "")
if not result.ok:
raise HTTPException(
status_code=400, detail=result.error or "Could not connect to the LightRAG server."
)
search_mode = (payload.search_mode or "").strip().lower()
if search_mode and search_mode not in SUPPORTED_MODES:
search_mode = ""
try:
manager = get_kb_manager()
entry = manager.register_lightrag_server_kb(
name,
result.base_url,
api_key=payload.api_key or "",
search_mode=search_mode,View on GitHub (pinned to 3e82f13042)
Solutions
- Provide both a non-empty name and server_url
- Validate both fields in the client before calling connect
- Use the probe endpoint first to confirm the URL, then connect
Example fix
// before
{"name": "", "server_url": "http://localhost:9621"}
// after
{"name": "main-rag", "server_url": "http://localhost:9621"} Defensive patterns
Strategy: validation
Validate before calling
const name = payload.name?.trim();
const url = payload.server_url?.trim();
if (!name || !url) throw new Error('Both name and server_url are required'); Prevention
- Run the probe endpoint first — it validates server_url and confirms reachability before connect
When it happens
Trigger: POST /connect-lightrag-server with a blank name, blank server_url, or both; typically a partially filled form or a payload built from unset config values.
Common situations: Frontend state not initialized for both fields, copy-paste leaving whitespace, or scripting the endpoint with placeholder empty strings.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- server_url is required.
- Invalid folder path
- Validation failed for file '{original_filename}': {format_ex
- LightRAG is not installed. Run `pip install 'deeptutor[rag-l
- result.error or "Could not connect to the LightRAG server."
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/0620dec94af7eda9.
Report an issue: GitHub.