90011: Channel released while not detached
channel_release_invalid_stateA request to release a channel was rejected because the channel was not in the initialized, detached or failed state, so it could still receive messages from Ably.
What you should do
Detach the channel and wait for the detach to complete before releasing it. Releasing only removes the SDK's reference to the channel so that it can be garbage collected; it does not detach the channel for you.
Why it happens
The SDK only releases a channel once there is no possibility of it receiving any further messages, which is the case when it is in one of the channel states initialized, detached or failed. A channel that is attaching, attached, detaching or suspended can still receive messages, and releasing it would leave messages arriving for a channel that the SDK no longer tracks.
Earlier SDK versions detached the channel automatically before releasing it. If you see this error after upgrading, detach the channel explicitly first.
What you'll see
The error is raised by the SDK rather than returned by Ably, with code 90011 and HTTP status 400. The message names the channel's current state.