{"record":{"id":"cae6983400f6d69a","repo":"invoke-ai/InvokeAI","slug":"invalid-or-expired-authentication-token","errorCode":null,"errorMessage":"Invalid or expired authentication token","messagePattern":"Invalid or expired authentication token","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"invokeai/app/api/auth_dependencies.py","lineNumber":134,"sourceCode":"\n    Returns:\n        TokenData containing user information from the token\n\n    Raises:\n        HTTPException: If token is missing, invalid, or expired (401 Unauthorized)\n    \"\"\"\n    if credentials is None:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"Missing authentication credentials\",\n            headers={\"WWW-Authenticate\": \"Bearer\"},\n        )\n\n    token = credentials.credentials\n    token_data = verify_token(token)\n\n    if token_data is None:\n        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"Invalid or expired authentication token\",\n            headers={\"WWW-Authenticate\": \"Bearer\"},\n        )\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        raise HTTPException(\n            status_code=status.HTTP_401_UNAUTHORIZED,\n            detail=\"User account is inactive or does not exist\",\n            headers={\"WWW-Authenticate\": \"Bearer\"},\n        )\n\n    return _db_derived_token_data(token_data, user)\n\n","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/auth_dependencies.py#L116-L152","documentation":"When prediction_type is 'flow_prediction', the scheduler must operate in the rectified-flow sigma regime (use_flow_sigmas=True), since flow models predict velocity over flow sigmas. The constructor raises this ValueError when the combination is mismatched; the comment notes it is 'not strictly invalid' but almost certainly a misconfiguration.","triggerScenarios":"ERSDEScheduler(prediction_type='flow_prediction', use_flow_sigmas=False) — e.g. reusing a VP-SDE-style config dict while only changing prediction_type, or a FLUX/Anima/rectified-flow model being loaded with the default use_flow_sigmas=False.","commonSituations":"Adapting a VP-diffusion pipeline to a rectified-flow checkpoint, copying scheduler args from a stable-diffusion config, or toggling prediction_type without updating use_flow_sigmas.","solutions":["Set use_flow_sigmas=True when prediction_type='flow_prediction'","Keep use_flow_sigmas=False and switch prediction_type to 'epsilon' or 'v_prediction' for VP-SDE regime","Update the scheduler config file/preset so the two flags agree"],"exampleFix":"// before\nsched = ERSDEScheduler(prediction_type=\"flow_prediction\", use_flow_sigmas=False)\n// after\nsched = ERSDEScheduler(prediction_type=\"flow_prediction\", use_flow_sigmas=True)","handlingStrategy":"validation","validationCode":"assert not (prediction_type == \"flow_prediction\" and not use_flow_sigmas)","typeGuard":"def is_consistent_flow_config(pt, use_flow_sigmas) -> bool:\n    return pt != \"flow_prediction\" or bool(use_flow_sigmas)","tryCatchPattern":"try:\n    sched = ERSDEScheduler(prediction_type=pt, use_flow_sigmas=u)\nexcept ValueError as e:\n    if \"use_flow_sigmas\" in str(e):\n        sched = ERSDEScheduler(prediction_type=pt, use_flow_sigmas=True)\n    else:\n        raise","preventionTips":["Tie use_flow_sigmas=True to flow models (FLUX/Anima/Z-Image)","Validate config pairs at load time, not at construction","Never toggle prediction_type without revisiting use_flow_sigmas"],"tags":["scheduler","config-validation","valueerror","rectified-flow"],"backgroundTag":"incompatible-config-combination","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}