Skip to content

Crash in PushNotificationsCategory.registerDevice(apnsToken:) – EXC_BREAKPOINT / preconditionFailure #5562

@khushbu-judal-deltatre

Description

@khushbu-judal-deltatre

Describe the bug
A crash occurs inside PushNotificationsCategory.registerDevice(apnsToken:) due to a triggered preconditionFailure.

The crash happens on a background thread (com.apple.root.user-initiated-qos.cooperative) and results in:
EXC_BREAKPOINT 0x0000000101584620 specialized static Fatal.preconditionFailure<A>(_:file:line:)

This indicates that an internal precondition inside registerDevice(apnsToken:) is being violated at runtime.

Stack Trace

Crashed: com.apple.root.user-initiated-qos.cooperative
0  ICCApp  specialized static Fatal.preconditionFailure<A>(_:file:line:)
1  ICCApp  PushNotificationsCategory.registerDevice(apnsToken:)

Observed Behavior

  • The app crashes immediately when registerDevice(apnsToken:) is executed.
  • The crash is caused by preconditionFailure, meaning a required invariant or assumption in the method is not satisfied.
  • The crash occurs on a background cooperative queue.
  • No graceful error handling occurs , the app terminates immediately.

To Reproduce
There is no 100% deterministic reproduction yet, but potential reproduction scenarios:

  • Launch the app fresh after install.
  • Allow push permissions.
  • Trigger device registration immediately after receiving the APNs token.
  • Rapidly re-trigger registration (e.g., app relaunch, login/logout flow).
  • Call registerDevice before required configuration/setup completes.
  • Crash appears to happen intermittently.

Expected Behaviour

  • registerDevice(apnsToken:) should:
  • Safely validate inputs.
  • Gracefully handle invalid state.
  • Log and return early instead of crashing.
  • The app should never terminate due to a precondition in production.

Stack Trace

Crashed: com.apple.root.user-initiated-qos.cooperative

0  ICCApp                         0x79b244 specialized static Fatal.preconditionFailure<A>(_:file:line:) + 4313461316
1  ICCApp                         0x7dca7c PushNotificationsCategory.registerDevice(apnsToken:) + 4313729660
2  libswift_Concurrency.dylib     0x62894 swift::runJobInEstablishedExecutorContext(swift::Job*) + 288
3  libswift_Concurrency.dylib     0x63d08 swift_job_runImpl(swift::Job*, swift::SerialExecutorRef) + 156
4  libdispatch.dylib              0x13f48 _dispatch_root_queue_drain + 364
5  libdispatch.dylib              0x146fc _dispatch_worker_thread2 + 180
6  libsystem_pthread.dylib        0x137c _pthread_wqthread + 232
7  libsystem_pthread.dylib        0x8c0 start_wqthread + 8

One more error I am getting while registering is, this can be a potential reason for the crash

▿ PushNotificationsError: 
Recovery suggestion: Please check that your inputs are valid.
Caused by:
TooManyRequestsException(properties: AWSPinpoint.TooManyRequestsException.Properties(message: nil, requestID: nil), httpResponse: 
Status Code: HTTP status code: 429 
 Content-Length: 31, 
x-amz-apigw-id: Yq0t4HryBcwEViw=, 
Date: Thu, 12 Feb 2026 12:58:00 GMT, 
Access-Control-Allow-Origin: *, 
x-amzn-requestid: 4eff52e9-dd45-4c6a-875b-fdc160a63714, 
x-amz-cf-id: IFwMcjSGOL6itigcnArcpOI66WdbsBa3TSGZ8xIv_bewJOdYf6D9KQ==, 
x-amz-cf-pop: BOM78-P2, 
x-amzn-errortype: TooManyRequestsException, 
Content-Type: application/json, 
Via: 1.1 26a8bf58d7e64927436546733cf15a24.cloudfront.net (CloudFront), 
x-cache: Error from cloudfront, message: Optional("Too Many Requests"), requestID: nil)
  ▿ service : 3 elements
    - .0 : ""
    - .1 : "Please check that your inputs are valid."
    ▿ .2 : Optional<Error>
      ▿ some : TooManyRequestsException
        ▿ properties : Properties
          - message : nil
          - requestID : nil
        ▿ httpResponse : 
Status Code: HTTP status code: 429 
 Content-Length: 31, 
x-amz-apigw-id: Yq0t4HryBcwEViw=, 
Date: Thu, 12 Feb 2026 12:58:00 GMT, 
Access-Control-Allow-Origin: *, 
x-amzn-requestid: 4eff52e9-dd45-4c6a-875b-fdc160a63714, 
x-amz-cf-id: IFwMcjSGOL6itigcnArcpOI66WdbsBa3TSGZ8xIv_bewJOdYf6D9KQ==, 
x-amz-cf-pop: BOM78-P2, 
x-amzn-errortype: TooManyRequestsException, 
Content-Type: application/json, 
Via: 1.1 26a8bf58d7e64927436546733cf15a24.cloudfront.net (CloudFront), 
x-cache: Error from cloudfront
        ▿ message : Optional<String>
          - some : "Too Many Requests"
        - requestID : nil

Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?
Replace preconditionFailure with safe handling
Instead of:
preconditionFailure("Some message")
Consider:

assertionFailure("Some message")
return

Or:

guard condition else {
    logger.error("Invalid state during push registration")
    return
}

Impact

  • App crashes in production.
  • Affects push registration flow.
  • Potentially impacts new installs and login flows.
  • High severity due to immediate termination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpending-maintainer-responseIssue is pending response from an Amplify team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions