invoke-ai/InvokeAI · error · HTTPException

Missing authentication credentials

Error message

Missing authentication credentials

What it means

solver_order controls the ER-SDE update order; __init__ restricts it to 1, 2, or 3 because only first-, second-, and third-order update rules are implemented. Values outside this set (0, 4, negative, non-int) raise this ValueError.

Source

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

    credentials: Annotated[HTTPAuthorizationCredentials | None, Depends(security)],
) -> TokenData:
    """Get current authenticated user from Bearer token.

    Note: This function accesses ApiDependencies.invoker.services.users directly,
    which is the established pattern in this codebase. The ApiDependencies.invoker
    is initialized in the FastAPI lifespan context before any requests are handled.

    Args:
        credentials: The HTTP authorization credentials containing the Bearer token

    Returns:
        TokenData containing user information from the token

    Raises:
        HTTPException: If token is missing, invalid, or expired (401 Unauthorized)
    """
    if credentials is None:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Missing authentication credentials",
            headers={"WWW-Authenticate": "Bearer"},
        )

    token = credentials.credentials
    token_data = verify_token(token)

    if token_data is None:
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Invalid or expired authentication token",
            headers={"WWW-Authenticate": "Bearer"},
        )

    # Verify the token still grants access: user exists, is active, epoch is current.
    user = resolve_authorized_user(token_data)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Pass solver_order=1, 2, or 3 (2 is a good default for quality/speed)
  2. Clamp/validate the order before constructing: solver_order = min(max(int(solver_order), 1), 3)
  3. Fix the model/UI preset that stores an unsupported order
  4. Implement/await a higher-order update in the scheduler if order 4+ is genuinely needed

Example fix

// before
sched = ERSDEScheduler(solver_order=4)
// after
sched = ERSDEScheduler(solver_order=3)
Defensive patterns

Strategy: validation

Validate before calling

assert solver_order in (1, 2, 3), f"bad solver_order={solver_order}"

Type guard

def is_valid_solver_order(o) -> bool:
    return isinstance(o, int) and o in (1, 2, 3)

Try / catch

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

Prevention

When it happens

Trigger: Constructing ERSDEScheduler with solver_order=0, 4, a float like 2.5, or a None leaking from a config dict; also when a UI/model config stores an order value copied from another scheduler family with a wider range.

Common situations: Experimenting with higher-order solvers assuming order 4 exists, config round-trips that turn ints into strings, and pipeline presets from other samplers (e.g. DPM-Solver++ S orders).

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/c44de6f5c434dea7. Report an issue: GitHub.