{"record":{"id":"67323ca495854fcd","repo":"QuantumNous/new-api","slug":"failed-to-start-passkey-login","errorCode":null,"errorMessage":"Failed to start Passkey login","messagePattern":"Failed to start Passkey login","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/features/auth/sign-in/components/user-auth-form.tsx","lineNumber":263,"sourceCode":"      return\n    }\n\n    if (!passkeySupported) {\n      toast.error(t('Passkey is not supported on this device'))\n      return\n    }\n\n    if (!navigator?.credentials) {\n      toast.error(t('Passkey is not available in this browser'))\n      return\n    }\n\n    setIsPasskeyLoading(true)\n    try {\n      const begin = await beginPasskeyLogin()\n      if (!begin.success) {\n        if (getServerErrorMessageKey(begin)) return\n        throw new Error(begin.message || t('Failed to start Passkey login'))\n      }\n\n      const publicKey = prepareCredentialRequestOptions(\n        begin.data?.options ?? begin.data\n      )\n      const flowToken = begin.data?.flow_token\n      if (!flowToken) {\n        throw new Error(t('Login flow expired. Please sign in again.'))\n      }\n\n      const credential = (await navigator.credentials.get({\n        publicKey,\n      })) as PublicKeyCredential | null\n\n      if (!credential) {\n        toast.info(t('Passkey login was cancelled'))\n        return\n      }","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/QuantumNous/new-api/blob/e2c7aa7b102c2075eae2377df3508658d45e88dc/web/src/features/auth/sign-in/components/user-auth-form.tsx#L245-L281","documentation":"Thrown in the sign-in form's Passkey handler when beginPasskeyLogin (the login-begin request) reports success:false without a server message key — the fallback 'Failed to start Passkey login' plus any server-provided message. It fires before any WebAuthn prompt, meaning the server refused or failed to issue credential request options.","triggerScenarios":"POST to the passkey login-begin endpoint returns success:false (no options, no flow_token): user has no registered passkeys, WebAuthn disabled server-side, session/CSRF failure, or backend error.","commonSituations":"User clicked 'Sign in with Passkey' with no passkey registered for the account; server-side passkey feature flag off; expired CSRF/session on the begin endpoint; backend 500.","solutions":["Read the begin response body — res.message usually carries the real reason (e.g. no credentials registered).","Confirm the account actually has a registered passkey and that passkey auth is enabled in server settings.","Retry after signing in with password and registering a passkey.","If server-side misconfig, enable WebAuthn/passkey in backend options and verify the begin endpoint returns options + flow_token."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!navigator?.credentials || !window.PublicKeyCredential) {\n  toast.error(t('Passkey is not available in this browser')); return\n}","typeGuard":null,"tryCatchPattern":"try {\n  const begin = await beginPasskeyLogin()\n  if (!begin.success) {\n    if (getServerErrorMessageKey(begin)) return // already surfaced globally\n    throw new Error(begin.message || t('Failed to start Passkey login'))\n  }\n} catch (error) {\n  if (getServerErrorMessageKey(error)) return\n  toast.error(error instanceof Error ? error.message : t('Passkey login failed'))\n}","preventionTips":["Hide the Passkey button when the account has no registered credentials or WebAuthn is unsupported","Verify server-side passkey enablement before exposing the option in the UI"],"tags":["passkey","webauthn","login","server-rejection"],"backgroundTag":null,"analyzedSha":"e2c7aa7b102c2075eae2377df3508658d45e88dc","analyzedAt":"2026-08-15T10:35:18.111Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}