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
- 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.
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
- 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.
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
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
Related errors
- SSO not configured
- Session refresh not configured
- Model "${modelId}" is not available. Available models: ${ids
- ACP connection is not initialized
- Model "${this.options.model}" is not available. Available mo
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/5e120a8dbf54195d.
Report an issue: GitHub.