{"record":{"id":"5e120a8dbf54195d","repo":"mastra-ai/mastra","slug":"credentials-authentication-not-configured","errorCode":null,"errorMessage":"Credentials authentication not configured","messagePattern":"Credentials authentication not configured","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/auth.ts","lineNumber":676,"sourceCode":"// ============================================================================\n\nexport const POST_CREDENTIALS_SIGN_IN_ROUTE = createPublicRoute({\n  method: 'POST',\n  path: '/auth/credentials/sign-in',\n  responseType: 'datastream-response',\n  bodySchema: credentialsSignInBodySchema,\n  summary: 'Sign in with credentials',\n  description: 'Authenticates a user with email and password.',\n  tags: ['Auth'],\n  handler: async ctx => {\n    const { mastra, request, email, password } = ctx as any;\n    const isStudio = isStudioRequest(request);\n\n    try {\n      const auth = getAuthProvider(mastra, isStudio);\n\n      if (!auth || !implementsInterface<ICredentialsProvider>(auth, 'signIn')) {\n        throw new HTTPException(404, { message: 'Credentials authentication not configured' });\n      }\n\n      const result = await auth.signIn(email, password, request);\n      const user = result.user as EEUser;\n\n      const responseBody = JSON.stringify({\n        user: {\n          id: user.id,\n          email: user.email,\n          name: user.name,\n          avatarUrl: user.avatarUrl,\n        },\n        token: result.token,\n      });\n\n      // Build response headers, including cookies from the auth provider\n      const headers = new Headers({\n        'Content-Type': 'application/json',","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/auth.ts#L658-L694","documentation":"This HTTP 404 error is thrown by the credentials sign-in route when the resolved auth provider is missing or does not implement `signIn` (ICredentialsProvider). Email/password sign-in is only available when the configured provider supports it.","triggerScenarios":"POST the credentials sign-in endpoint when getAuthProvider(mastra, isStudio) returns nothing, or the provider lacks a signIn method — e.g. an SSO-only provider is configured for the request's context.","commonSituations":"Deployments configured exclusively with SSO while the frontend still posts email/password; studio vs non-studio provider mismatch; no auth provider configured at all.","solutions":["Configure a credentials-capable auth provider (implementing signIn) for the relevant context, or add credentials support alongside SSO.","If using SSO-only auth, switch the client to the SSO login flow instead of email/password sign-in.","Check the studio/non-studio provider resolution so the request hits a context where a credentials provider is configured."],"exampleFix":"// before\nserver: { authConfig: new SSOOnlyProvider() } // no signIn()\n// after\nserver: { authConfig: new CombinedProvider(new CredentialsProvider(), new SSOOnlyProvider()) }","handlingStrategy":"validation","validationCode":"// detect whether credentials sign-in is offered before rendering the form\nconst res = await fetch('/api/auth/providers'); // or a capabilities endpoint\nconst caps = await res.json();\nif (!caps.credentials) hidePasswordForm();","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch('/api/auth/credentials/sign-in', { method: 'POST', body });\n  if (res.status === 404) showSSOButtonOnly(); // credentials not configured\n} catch (e) { /* fall back to SSO flow */ }","preventionTips":["Align the login UI with the server's configured auth providers (SSO-only vs credentials).","Feature-detect available sign-in methods at app startup.","Ensure the provider configured for the request's context implements signIn."],"tags":["http-404","credentials","auth-configuration"],"backgroundTag":"auth-provider-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}