© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
3 replies
Mio

Sign-Up Error: "Database error saving new user"

Hi everyone,

I’m new to Supabase and currently building a Flutter app with a sign-up feature. I’ve run into an issue and could really use some help.

When I try to sign up a new user, I get this error:

AuthException(message: {"code":"unexpected_failure","message":"Database error saving new user"}, statusCode: 500, errorCode: null)
AuthException(message: {"code":"unexpected_failure","message":"Database error saving new user"}, statusCode: 500, errorCode: null)


Here’s the part of my code where the sign-up happens:

final supabase = Supabase.instance.client;

Future<void> _signUp() async {
if (!_formKey.currentState!.validate()) return;

setState(() {
_isLoading = true;
_errorMessage = null;
});

try {
final email = _emailController.text.trim();
final password = _passwordController.text.trim();

final authResponse = await supabase.auth.signUp(
email: email,
password: password,
);

if (authResponse.user != null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('Welcome ${authResponse.user!.email!}')),
);
Navigator.of(context).pushReplacementNamed('/choice');
} else if (authResponse.error != null) {
setState(() {
_errorMessage = authResponse.error.message;
});
}
} catch (e) {
setState(() {
_errorMessage = 'An error occurred: $e';
});
print('Error during sign-up: $e');
} finally {
setState(() {
_isLoading = false;
});
}
}

I’ve been stuck on this and can’t figure out what’s causing the "unexpected_failure" error 🥲. Has anyone else experienced this or know how to fix it? Any tips or advice would be really appreciated!

Thanks in advance!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Database error saving new user
SupabaseSSupabase / help-and-questions
4y ago
Database error saving new user
SupabaseSSupabase / help-and-questions
6mo ago
Database error saving new user
SupabaseSSupabase / help-and-questions
6mo ago
OAuth Error: "Database error saving new user" with Google Sign-In
SupabaseSSupabase / help-and-questions
6mo ago