Skip to content

feat(mobile): display error on app init fail#22758

Closed
denysvitali wants to merge 3 commits intoimmich-app:mainfrom
denysvitali:feature/display-error-on-app-init-fail
Closed

feat(mobile): display error on app init fail#22758
denysvitali wants to merge 3 commits intoimmich-app:mainfrom
denysvitali:feature/display-error-on-app-init-fail

Conversation

@denysvitali
Copy link

Description

Before this change, the application, in case of error, was silently failing.

In my case, the missing IsarCore library caused the app to be constantly restarted (result = stuck at the Immich logo forever) without any message on screen or on the console.

This fixes a similar behavior like #1815 and #2005 - in that case the user was not able to report an additional information due to the missing error handling. Ironically, in that case the cause of failure was the same as mine - but it wasn't immediately clear to me (actually, it took me several hours to debug) on what was causing it.

With this PR, we now have a proper error handling in case of init failures.

TL;DR:

image

How Has This Been Tested?

Runned the app in debug mode on my device.

Screenshots (if appropriate)

image

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

Pretty much all done with Z.AI's GLM-4.6 - minor corrections here and there.

@shenlong-tanwen
Copy link
Member

Although the core issue is fixed in #22757, it might not be a bad idea to have some sort of error page such as this.

Comment on lines +181 to +198
// Restart button
ElevatedButton.icon(
onPressed: () {
// Attempt to restart the app
if (Platform.isAndroid || Platform.isIOS) {
exit(0);
}
},
icon: const Icon(Icons.close),
label: const Text('Close App'),
style: ElevatedButton.styleFrom(
backgroundColor: theme.colorScheme.error,
foregroundColor: theme.colorScheme.onError,
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
),
),
],
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not have a restart button. Apple recommends against calling exit programatically
https://developer.apple.com/library/archive/qa/qa1561/_index.html

Can you also fix the failing static analysis?

Copy link
Member

@shenlong-tanwen shenlong-tanwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you localise the strings used in the PR and make the other reviewed changes after rebasing this over main?

Comment on lines +31 to +35
Image.asset(
'assets/immich-logo.png',
width: 80,
height: 80,
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an ImmichLogo widget available

@bwees
Copy link
Member

bwees commented Feb 2, 2026

The core team is working on an error page to handle init failures. We are going to close this in favor of that one.

Thank you for the contribution!

@bwees bwees closed this Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants