HKUDS/DeepTutor · error · ValueError
Unknown user id: {user_id}
Error message
Unknown user id: {user_id} What it means
Error "Unknown user id: {user_id}" thrown in HKUDS/DeepTutor.
Source
Thrown at deeptutor/multi_user/grants.py:104
exec_enabled = payload.get("exec_enabled")
base["exec_enabled"] = bool(exec_enabled) if isinstance(exec_enabled, bool) else None
return base
def load_grant(user_id: str) -> dict[str, Any]:
path = grant_path(user_id)
if not path.exists():
return empty_grant(user_id)
try:
return normalize_grant(user_id, json.loads(path.read_text(encoding="utf-8")))
except Exception:
return empty_grant(user_id)
def save_grant(user_id: str, payload: dict[str, Any]) -> dict[str, Any]:
user_record = get_user_by_id(user_id)
if user_record is None:
raise ValueError(f"Unknown user id: {user_id}")
_username, record = user_record
if str(record.get("role") or "user") == "admin":
raise ValueError("Admin users use the main workspace and cannot receive assignments.")
grant = normalize_grant(user_id, payload)
validate_grant(grant)
path = grant_path(user_id)
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(grant, indent=2, ensure_ascii=False), encoding="utf-8")
return grant
def validate_grant(grant: dict[str, Any]) -> None:
"""Reject accidental secret/path material in grants.
Grants carry logical ids only. Runtime resolution happens server-side.
"""
forbidden = {"api_key", "secret", "password", "token", "path", "base_url"}
View on GitHub (pinned to 3e82f13042)
When it happens
Trigger: Thrown at deeptutor/multi_user/grants.py:104 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/a8a18ad2078fb0cd.
Report an issue: GitHub.