Skip to content

Crash on New User Signup (Friends List 404) #675

@Dikshant005

Description

@Dikshant005

🐛 Describe the bug

When a new user signs up and logs in for the first time, the application throws an unhandled exception and immediately redirects back to the Welcome/Login screen instead of proceeding to the Home screen.

The Cause: Upon login, the FriendsController initializes and attempts to fetch the user's "Friends List" document from the Appwrite database. For a brand new user, this document does not exist yet. Appwrite returns a 404 Document Not Found error.

The current code treats this 404 as a critical failure instead of a valid "empty" state. This exception causes the user profile initialization to fail, triggering the catch block in auth_state_controller.dart, which forces a redirect back to the WelcomeScreen. It also triggers a secondary No Overlay widget found error because it attempts to show an error Snackbar during the screen transition.

lib/controllers/friends_controller.dart. The getFriendsList() method does not handle the 404 case for new users.

Steps to Reproduce:

Run the app on a fresh install (or clear app data).

specific user signup flow to create a new account.

Observe the crash/redirect immediately after clicking "Sign Up".

E/flutter (19429): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: AppwriteException: document_not_found, Document with the requested ID could not be found. (404)
E/flutter (19429): #0 ClientMixin.prepareResponse (package:appwrite/src/client_mixin.dart:95:9)
E/flutter (19429): #1 ClientIO.call (package:appwrite/src/client_io.dart:415:14)
E/flutter (19429):
E/flutter (19429): #2 Databases.getDocument (package:appwrite/services/databases.dart:205:17)
E/flutter (19429):
E/flutter (19429): #3 FriendsController.getFriendsList (package:resonate/controllers/friends_controller.dart:98:21)
E/flutter (19429):
E/flutter (19429): #4 FriendsController.onInit (package:resonate/controllers/friends_controller.dart:40:5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions