HKUDS/DeepTutor · error · HTTPException

Model configuration is managed by an administrator.

Error message

Model configuration is managed by an administrator.

What it means

Administrative gate: an attempt was made to change model configuration through a path reserved for administrators; per-deployment policy centralizes model config, so non-admin callers get this refusal instead of a silent partial write.

Solutions

  1. Ask an administrator to apply the model configuration change
  2. Use the user-scoped endpoints (e.g. patch_ui_settings) for preferences that are user-owned
  3. Check the authenticated user actually holds the admin role before calling admin routes
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at deeptutor/api/routers/settings.py:408 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/321907a3566d8416. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/api/routers/settings.py:408

    router saves alongside six capability writes lost every one of the router's.

    Prefer :func:`patch_ui_settings` for changing individual fields. This
    replaces the whole document, so a caller that builds it from
    ``load_ui_settings`` writes the merged defaults back as stored values and
    stops following later changes to any of them.
    """
    payload = dict(settings)
    atomic_update(_settings_file(), lambda _stored: payload)


def patch_ui_settings(**fields: Any) -> None:
    """Change individual UI fields without rewriting the rest of the document."""
    atomic_update(_settings_file(), lambda stored: {**stored, **fields})


def _require_settings_admin() -> None:
    if not get_current_user().is_admin:
        raise HTTPException(
            status_code=status.HTTP_403_FORBIDDEN,
            detail="Model configuration is managed by an administrator.",
        )


def _require_codex_oauth_actor() -> None:
    """Gate the Codex OAuth lifecycle: personal, not administrative.

    Every one of these endpoints acts on the *caller's own* credentials —
    ``get_codex_oauth_service()`` resolves the store, the model catalog, and
    the callback route from owner scope — so requiring an administrator was
    what left ordinary users unable to use Codex at all: an owner-bound
    profile is (correctly) never grantable, and they could not sign in for
    themselves either (#781).

    A partner is refused: it is a synthetic user whose owner is a real
    account, so letting one in would mean acting on that person's login —
    including signing them out. Partners inherit the owner's login at call

View on GitHub (pinned to 3e82f13042)