invoke-ai/InvokeAI · error · HTTPException

User not found or inactive

Error message

User not found or inactive

What it means

ERSDEScheduler.__init__ validates prediction_type at construction and accepts only 'epsilon', 'v_prediction', or 'flow_prediction'. Any other string (or a misnamed alias like 'sample'/'flow') is rejected because the step logic in _convert_model_output can only invert those three parameterizations.

Source

Thrown at invokeai/app/api/auth_dependencies.py:80

    # `_identify_video_upload_user`). So this refuses only real, minted tokens.
    if token_data.user_id == SYSTEM_USER_ID:
        return None
    user = ApiDependencies.invoker.services.users.get(token_data.user_id)
    if user is None or not user.is_active:
        return None
    if token_data.token_epoch != user.token_epoch:
        return None
    return user


def _validate_token(token: str, invalid_detail: str) -> TokenData:
    token_data = verify_token(token)
    if token_data is None:
        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=invalid_detail)

    user = resolve_authorized_user(token_data)
    if user is None:
        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="User not found or inactive")
    return _db_derived_token_data(token_data, user)


def _db_derived_token_data(token_data: TokenData, user: "UserDTO") -> TokenData:
    """Build TokenData whose authorization fields come from the database record.

    The JWT proves *identity* only. Authorization (``is_admin``) must reflect the
    current database state on every request; otherwise a demoted administrator
    keeps admin rights until their token expires — and sliding-window refresh
    would renew that stale claim indefinitely. A promoted user symmetrically
    gains admin rights on their next request without re-login.

    The epoch is carried through from the record so a refreshed token stays valid
    (callers only reach here once ``_token_epoch_is_current`` has passed).
    """
    return TokenData(
        user_id=user.user_id,
        email=user.email,

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Set prediction_type to one of 'epsilon', 'v_prediction', 'flow_prediction'
  2. Map the upstream model's prediction type before constructing the scheduler (e.g. 'sample' -> 'epsilon')
  3. Fix the scheduler_config.json / model config entry that carries the invalid value
  4. Update InvokeAI if the checkpoint uses a newer prediction type the current version rejects

Example fix

// before
sched = ERSDEScheduler(prediction_type="sample")
// after
sched = ERSDEScheduler(prediction_type="epsilon")
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {"epsilon", "v_prediction", "flow_prediction"}
assert prediction_type in ALLOWED, prediction_type

Type guard

def is_valid_prediction_type(pt) -> bool:
    return pt in ("epsilon", "v_prediction", "flow_prediction")

Try / catch

try:
    sched = ERSDEScheduler(prediction_type=prediction_type)
except ValueError as e:
    if "prediction_type" in str(e):
        sched = ERSDEScheduler(prediction_type="epsilon")
    else:
        raise

Prevention

When it happens

Trigger: Passing e.g. prediction_type='sample', 'linear_prediction', or a config copied from a non-ER-SDE scheduler into ERSDEScheduler(...). Also raised when prediction_type is loaded from a scheduler config JSON written by a different library version.

Common situations: Copying scheduler kwargs from diffusers Euler/Scheduler configs that allow 'sample', typos like 'flow', or pipeline code that forwards the base model's prediction type without mapping it to one of the three supported values.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/2705ca9a6b88405a. Report an issue: GitHub.