This will occur when a client ID is invalid, which will either be due to using disallowed characters, or other restrictions placed on allowed client IDs.

 The string "*" is not allowed as a client ID since that string is used in capability expressions as a wildcard.

If a client attempts to assume a clientID, "foo", whilst the token they're using to connect to Ably has specified another clientID, "bar", this will result in a 40012 error. This is due to the client not having the authority to assume a different client ID in this situation.

Further reading: