FCM push notification issue: "error":"NotRegistered"

FCM push notification issue: "error":"NotRegistered"

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

FCM push notification issue: "error":"NotRegistered"

When deploying a Firebase Cloud Messaging (FCM) solution, you might encounter scenarios where single-device broadcasts succeed flawlessly, but batched sends fail immediately. A common symptom of this is the canonical_ids: 0 counter in your response alongside specific errors like "error":"NotRegistered". This behavior indicates that at least one token in your multicast payload has been revoked by Firebase on their end.

The code snippet provided demonstrates a typical PHP approach to sending notifications using cURL to the FCM HTTP endpoint. The logic fetches device tokens from a database, constructs a JSON payload with registration_ids, and executes the request. While this works for individual sends, batching multiple tokens often triggers failures if any single token in that batch is invalid.

The root cause of the "NotRegistered" error lies in how FCM handles multicast groups. When you send a notification to multiple devices simultaneously, FCM attempts to route the message to every device listed in the registration_ids array. If even one device has uninstalled the app, cleared its data, or had their session expire, Firebase marks that specific token as invalid. The service then returns an error for that specific entry while still delivering the message to the remaining valid tokens.

In the provided example, the response shows "success":1 and "failure":1. This confirms that the server accepted the request, but one device could not receive it. Crucially, note the "canonical_ids":0 field in the sample output where an error occurred. Historically, FCM returned canonical_ids: 1 for every failed token to indicate which ones needed refreshing. In modern versions of the API, this field might behave differently depending on the SDK or specific response format, but the presence of "error":"NotRegistered" is the definitive signal that a token has been invalidated by the server.

A frequent mistake developers make when debugging this issue is assuming the tokens stored in their database are correct because they were valid yesterday. FCM does not automatically update your local database when a user uninstalls an app or clears their notification settings on Android. If you simply retry sending to the stale token, the error will persist until you explicitly handle the invalidation.

To resolve this, you must implement a cleanup strategy within your application logic. When a "NotRegistered" error is returned for a specific device token:

  1. Identify the failed token: Parse the results array in the JSON response to isolate the specific index that generated the error.
  2. Remove from database: Immediately delete or flag that token in your database as invalid.
  3. Retry logic: If your application requires guaranteed delivery, you might implement a retry mechanism for failed tokens after a set period (e.g., 5 minutes). If the token remains invalid upon retry, permanently remove it.

It is important to note that the canonical_token field, which would contain the new valid token if one was issued during the error event, is not always included in the HTTP v1 payload in the same way as SDK responses. In many cases, FCM expects you to discard the old token immediately. If your app requires real-time subscription updates, consider using the Firebase Admin SDK or integrating with the app's backend to listen for onMessageReceived events that handle token refreshes automatically, rather than relying solely on stored tokens in a database table.

Ensure that your server configuration allows HTTPS and that you are using the latest API keys. While the provided code uses CURLOPT_SSL_VERIFYPEER, false, this is generally discouraged in production environments as it bypasses certificate validation, potentially exposing the connection to man-in-the-middle attacks. Always verify peer certificates to maintain security compliance.

For high-volume applications, managing token lifecycle manually becomes increasingly complex. If you are using a framework like Laravel, leveraging existing packages or services that abstract this logic can reduce the risk of token staleness. The core principle remains: treat every "NotRegistered" error as a permanent invalidation of that specific device identity until it is explicitly re-registered.

Our network