{"record":{"id":"fffcdc7e36c82696","repo":"invoke-ai/InvokeAI","slug":"authentication-required","errorCode":null,"errorMessage":"Authentication required","messagePattern":"Authentication required","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"invokeai/app/api/auth_dependencies.py","lineNumber":185,"sourceCode":"        credentials: The HTTP authorization credentials containing the Bearer token\n\n    Returns:\n        TokenData containing user information from the token, or system user in single-user mode\n\n    Raises:\n        HTTPException: 401 Unauthorized if in multiuser mode and credentials are missing, invalid, or user is inactive\n    \"\"\"\n    # Get configuration to check if multiuser is enabled\n    config = ApiDependencies.invoker.services.configuration\n\n    # In single-user mode (multiuser=False), always return system user with admin privileges\n    if not config.multiuser:\n        return TokenData(user_id=\"system\", email=\"system@system.invokeai\", is_admin=True)\n\n    # Multiuser mode is enabled - validate credentials\n    if credentials is None:\n        # In multiuser mode, authentication is required\n        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=\"Authentication required\")\n\n    token = credentials.credentials\n    token_data = verify_token(token)\n\n    if token_data is None:\n        # Invalid token in multiuser mode - reject\n        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=\"Invalid or expired token\")\n\n    # Verify the token still grants access: user exists, is active, epoch is current.\n    user = resolve_authorized_user(token_data)\n\n    if user is None:\n        # Missing, inactive, or revoked in multiuser mode - reject\n        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail=\"User not found or inactive\")\n\n    return _db_derived_token_data(token_data, user)\n\n","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/auth_dependencies.py#L167-L203","documentation":"set_timesteps accepts exactly one of num_inference_steps, timesteps, or sigmas; the internal n_set count must equal 1. Passing none, two, or all three raises this ValueError, because the resulting sigma schedule would be ambiguous.","triggerScenarios":"Calling set_timesteps() with no args, set_timesteps(num_inference_steps=20, sigmas=custom_sigmas), or a pipeline wrapper that forwards both a step count and an explicit sigma list from model config.","commonSituations":"Combining a UI 'steps' setting with a preset sigma schedule from FLUX/Z-Image, refactored pipeline code adding sigmas while keeping num_inference_steps, or calling set_timesteps() as a no-op refresh with defaults all None.","solutions":["Pass exactly one argument — drop the others, e.g. set_timesteps(num_inference_steps=20)","If using pre-shifted sigmas (Anima/FLUX/Z-Image), pass sigmas only","Guard with an assertion/logic that clears num_inference_steps when sigmas are supplied","Fix the calling pipeline (init_scheduler/_run_diffusion/denoise) to select one source"],"exampleFix":"// before\nsched.set_timesteps(num_inference_steps=20, sigmas=custom_sigmas)\n// after\nsched.set_timesteps(sigmas=custom_sigmas)","handlingStrategy":"validation","validationCode":"opts = [x for x in (num_inference_steps, timesteps, sigmas) if x is not None]\nassert len(opts) == 1, \"pass exactly one of num_inference_steps/timesteps/sigmas\"","typeGuard":"def has_single_schedule_source(n, t, s) -> bool:\n    return sum(x is not None for x in (n, t, s)) == 1","tryCatchPattern":"try:\n    sched.set_timesteps(num_inference_steps=n, timesteps=t, sigmas=s)\nexcept ValueError as e:\n    if \"exactly one\" in str(e):\n        sched.set_timesteps(num_inference_steps=n or 30)\n    else:\n        raise","preventionTips":["Pick one schedule source per pipeline run","Clear num_inference_steps when injecting custom sigmas","Centralize set_timesteps calls in a pipeline helper"],"tags":["scheduler","argument-validation","valueerror","diffusion"],"backgroundTag":"mutually-exclusive-arguments","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}