mastra-ai/mastra · error · HTTPException

Credentials authentication not configured

Error message

Credentials authentication not configured

What it means

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.

Source

Thrown at packages/server/src/server/handlers/auth.ts:676

// ============================================================================

export const POST_CREDENTIALS_SIGN_IN_ROUTE = createPublicRoute({
  method: 'POST',
  path: '/auth/credentials/sign-in',
  responseType: 'datastream-response',
  bodySchema: credentialsSignInBodySchema,
  summary: 'Sign in with credentials',
  description: 'Authenticates a user with email and password.',
  tags: ['Auth'],
  handler: async ctx => {
    const { mastra, request, email, password } = ctx as any;
    const isStudio = isStudioRequest(request);

    try {
      const auth = getAuthProvider(mastra, isStudio);

      if (!auth || !implementsInterface<ICredentialsProvider>(auth, 'signIn')) {
        throw new HTTPException(404, { message: 'Credentials authentication not configured' });
      }

      const result = await auth.signIn(email, password, request);
      const user = result.user as EEUser;

      const responseBody = JSON.stringify({
        user: {
          id: user.id,
          email: user.email,
          name: user.name,
          avatarUrl: user.avatarUrl,
        },
        token: result.token,
      });

      // Build response headers, including cookies from the auth provider
      const headers = new Headers({
        'Content-Type': 'application/json',

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure a credentials-capable auth provider (implementing signIn) for the relevant context, or add credentials support alongside SSO.
  2. If using SSO-only auth, switch the client to the SSO login flow instead of email/password sign-in.
  3. Check the studio/non-studio provider resolution so the request hits a context where a credentials provider is configured.

Example fix

// before
server: { authConfig: new SSOOnlyProvider() } // no signIn()
// after
server: { authConfig: new CombinedProvider(new CredentialsProvider(), new SSOOnlyProvider()) }
Defensive patterns

Strategy: validation

Validate before calling

// detect whether credentials sign-in is offered before rendering the form
const res = await fetch('/api/auth/providers'); // or a capabilities endpoint
const caps = await res.json();
if (!caps.credentials) hidePasswordForm();

Try / catch

try {
  const res = await fetch('/api/auth/credentials/sign-in', { method: 'POST', body });
  if (res.status === 404) showSSOButtonOnly(); // credentials not configured
} catch (e) { /* fall back to SSO flow */ }

Prevention

When it happens

Trigger: 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.

Common situations: Deployments configured exclusively with SSO while the frontend still posts email/password; studio vs non-studio provider mismatch; no auth provider configured at all.

Understand the failure class

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/5e120a8dbf54195d. Report an issue: GitHub.