61002: Device registered to a different clientId

device_registration_client_id_mismatch

Push activation was rejected because the device already holds a registration belonging to a different clientId. This usually happens when a device is activated again after a different user has signed in.

What you should do

Deactivate push on the device, then activate it again. Deactivating deregisters the device with Ably and clears the identity held in local device state, so the next activation registers the device against the clientId the client is currently authenticated as.

This is a permanent failure rather than a transient one, so retrying activation without deactivating first produces the same error every time.

Why it happens

A device's push registration is bound to the clientId that was authenticated when the device was activated. Activating again compares the clientId held in local device state against the clientId the client is presently authenticated as, and fails when the two differ. The registration itself is left untouched, so the device continues to receive notifications addressed to the original clientId.

The common trigger is a shared device where one user signs out and another signs in, and the application activates push for the new user without deactivating the previous registration first. It also occurs when the clientId an application authenticates as changes for any other reason while a device registration is still in place, for example when the token supplied to an already activated device is issued for a different clientId.

What you'll see

The error is reported with code 61002 and, in most SDKs, HTTP status 400. It is delivered asynchronously rather than as the response to a request: through the activation callback when activation triggered the check, and through the push registration update failure callback when something else did. The message is Activation failed: present clientId is not compatible with existing device registration, except in the Ably Pub/Sub JavaScript SDK, which reports clientId not compatible with local device clientId.