[firebase_messaging]: Android getToken() errors lose their cause since firebase-messaging 25.1.0 ("FCM Registration failed!")

Open
#18,997 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 4 days

@SelaseKay is already working on this.

Since Nov 24, 2026.

  • #18999 by @SelaseKay — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
22/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
android, dart, java
Domain
mobile

Research direction

Start with the Android side of FirebaseMessaging.getToken() and the Dart error mapping that turns the native exception into firebase_messaging/unknown. Reproduce with the adb steps in the issue, then check how the underlying exception cause is dropped. Pull request #18999 is already open against this, so review it before starting. Done means the native failure reason, such as SERVICE_NOT_AVAILABLE, reaches Dart.

Written by the indexing model from the issue text.

Description

Needs Attention platform: android plugin: messaging reproduced type: bug
Is there an existing issue for this?
  • I have searched the existing issues.
Which plugins are affected?

Messaging

Which platforms are affected?

Android

Description

Since firebase_core 4.11.0 (Firebase Android BoM 34.15.0, firebase-messaging 25.1.0), when the token registration fails, getToken() on Android reaches Dart with the same text, whatever the reason:

[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!

The underlying reason, such as SERVICE_NOT_AVAILABLE or AUTHENTICATION_FAILED, does not reach Dart. Apps can no longer tell a network problem apart from other registration failures.

We see this on many Android devices and versions in production and can't tell the failures apart.

Reproducing the issue

Setup

  • Pixel 5, Android 14, Google Play services
  • firebase_messaging 16.7.0, firebase_core 4.15.0 (Firebase Android BoM 34.19.0, firebase-messaging 25.1.3)

Steps

  1. With the device online, call await FirebaseMessaging.instance.deleteToken(). This removes the cached token, so the next getToken() has to register again.
  2. Block network access for Google Play services:
    adb shell cmd connectivity set-chain3-enabled true
    adb shell cmd connectivity set-package-networking-enabled false com.google.android.gms
    
  3. Call await FirebaseMessaging.instance.getToken().

Result

After about 30 seconds, getToken() throws:

[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!

The app's logcat has no FirebaseMessaging line about it.

Clean up

adb shell cmd connectivity set-package-networking-enabled true com.google.android.gms
adb shell cmd connectivity set-chain3-enabled false

Then call getToken() again to register a new token.

Firebase Core version

4.15.0

Flutter Version

3.44.9

Relevant Log Output
# getToken() after deleteToken(), Play services blocked
[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!

# FCM's own token sync at app start, same failure
E/FirebaseMessaging: Topic sync or token retrieval failed on hard failure exceptions: FCM Registration failed!. Won't retry the operation.
[firebase_messaging/unknown] java.io.IOException: FCM Registration failed!
Flutter dependencies
Expand Flutter dependencies snippet

firebase_core 4.15.0
firebase_messaging 16.7.0
firebase_messaging_platform_interface 4.10.0

Additional context and comments

No response

Dominant language
Dart
Stars
9.3k
Forks
4.1k
Avg merge
4d 17h
Merged PRs (30d)
49

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/flutterfire

All issues in firebase/flutterfire

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.