{"record":{"id":"0d8dc039e3ede35c","repo":"HKUDS/DeepTutor","slug":"admin-users-use-the-main-workspace-and-cannot-rece","errorCode":null,"errorMessage":"Admin users use the main workspace and cannot receive assignments.","messagePattern":"Admin users use the main workspace and cannot receive assignments\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/multi_user/grants.py","lineNumber":107,"sourceCode":"\n\ndef load_grant(user_id: str) -> dict[str, Any]:\n    path = grant_path(user_id)\n    if not path.exists():\n        return empty_grant(user_id)\n    try:\n        return normalize_grant(user_id, json.loads(path.read_text(encoding=\"utf-8\")))\n    except Exception:\n        return empty_grant(user_id)\n\n\ndef save_grant(user_id: str, payload: dict[str, Any]) -> dict[str, Any]:\n    user_record = get_user_by_id(user_id)\n    if user_record is None:\n        raise ValueError(f\"Unknown user id: {user_id}\")\n    _username, record = user_record\n    if str(record.get(\"role\") or \"user\") == \"admin\":\n        raise ValueError(\"Admin users use the main workspace and cannot receive assignments.\")\n    grant = normalize_grant(user_id, payload)\n    validate_grant(grant)\n    path = grant_path(user_id)\n    path.parent.mkdir(parents=True, exist_ok=True)\n    path.write_text(json.dumps(grant, indent=2, ensure_ascii=False), encoding=\"utf-8\")\n    return grant\n\n\ndef validate_grant(grant: dict[str, Any]) -> None:\n    \"\"\"Reject accidental secret/path material in grants.\n\n    Grants carry logical ids only. Runtime resolution happens server-side.\n    \"\"\"\n    forbidden = {\"api_key\", \"secret\", \"password\", \"token\", \"path\", \"base_url\"}\n\n    def walk(value: Any, trail: str = \"grant\") -> None:\n        if isinstance(value, dict):\n            for key, child in value.items():","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/multi_user/grants.py#L89-L125","documentation":"Error \"Admin users use the main workspace and cannot receive assignments.\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/multi_user/grants.py:107 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}