HKUDS/DeepTutor · error · PermissionError

This model is not assigned to your account.

Error message

This model is not assigned to your account.

What it means

PermissionError from apply_allowed_llm_selection: the submitted LLM selection's (profile_id, model_id) pair does not appear in redacted_model_access(user.id)['llm'], i.e. the model was never granted (or was redacted away) for the current user.

Source

Thrown at deeptutor/multi_user/model_access.py:167

    if user.is_admin:
        return True
    if user_id is None:
        user_id = user.id
    items = redacted_model_access(user_id).get(capability, []) or []
    return any(item.get("available") for item in items)


def apply_allowed_llm_selection(selection: dict[str, Any] | None) -> dict[str, Any] | None:
    """Allow only admin-granted LLM profile/model selections for ordinary users."""
    user = get_current_user()
    if user.is_admin or not selection:
        return selection
    profile_id = str(selection.get("profile_id") or "")
    model_id = str(selection.get("model_id") or "")
    for item in redacted_model_access(user.id).get("llm", []):
        if item.get("profile_id") == profile_id and item.get("model_id") == model_id:
            return selection
    raise PermissionError("This model is not assigned to your account.")

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Refresh the model list from the user's accessible models endpoint and re-select from it
  2. Ask an admin to grant the model/profile to the user
  3. Clear the stale saved selection before starting a turn

Example fix

// before
apply_allowed_llm_selection({"profile_id": "codex-owner", "model_id": "gpt-x"})
# PermissionError

// after
allowed = redacted_model_access(user.id)["llm"]
sel = next(m for m in allowed if m["model_id"] == "gpt-x")
apply_allowed_llm_selection({"profile_id": sel["profile_id"], "model_id": sel["model_id"]})
Defensive patterns

Strategy: validation

Validate before calling

allowed = {(m["profile_id"], m["model_id"]) for m in redacted_model_access(user.id)["llm"]}
if (sel["profile_id"], sel["model_id"]) not in allowed:
    sel = next(iter(allowed))  # reset to a granted model

Type guard

def selection_allowed(selection: dict, user) -> bool:
    allowed = redacted_model_access(user.id)["llm"]
    return any(m["profile_id"] == selection.get("profile_id") and m["model_id"] == selection.get("model_id") for m in allowed)

Try / catch

try:
    apply_allowed_llm_selection(selection)
except PermissionError:
    selection = default_granted_selection(user)  # re-pick from allowed list
    apply_allowed_llm_selection(selection)

Prevention

When it happens

Trigger: Submitting an LLM selection payload with a profile_id/model_id combination not granted; using a codex profile bound to a different owner; saving grants after an admin revoked the model; stale client-side model picker state.

Common situations: Multi-user grants where admins restrict models; owner-bound codex profiles leaking into pickers; switching accounts with cached selections.

Related errors


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