← ClaudeAtlas

explain-errorlisted

Automatically diagnoses, explains, and resolves Better Auth runtime errors, configuration issues, database adapter mismatches, and authentication failure codes.
smicolon/ai-kit · ★ 6 · AI & Automation · score 79
Install: claude install-skill smicolon/ai-kit
# Better Auth Error Diagnostician & Explainer This skill diagnoses and provides actionable resolutions for common Better Auth runtime errors, client error codes, configuration pitfalls, and database adapter issues. ## Common Error Codes & Resolutions ### 1. `INVALID_EMAIL_OR_PASSWORD` - **Cause**: User credentials do not match database records, or password hashing mismatch. - **Resolution**: - Verify that password hashing algorithm has not changed between migrations. - Verify that input email is trimmed/lowercased if `emailAndPassword.autoSignIn` or normalization is enabled. - Check client-side error handling: ```typescript const { data, error } = await authClient.signIn.email({ email, password, }) if (error?.status === 401 || error?.code === 'INVALID_EMAIL_OR_PASSWORD') { // Prompt user with user-friendly message } ``` ### 2. `USER_ALREADY_EXISTS` - **Cause**: Attempting to sign up with an email or account ID already in use. - **Resolution**: - Direct user to sign in or password reset flow. - If social login is used with existing email, check `accountLinking.enabled`: ```typescript export const auth = betterAuth({ account: { accountLinking: { enabled: true, trustedProviders: ['google', 'github'], }, }, }) ``` ### 3. `SESSION_EXPIRED` / `UNAUTHORIZED` - **Cause**: Cookie expired, missing `credentials: "include"` on cross-origin fetch, or cookie domain misma