Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions errors/codes/90011.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
code: 90011
identifier: channel_release_invalid_state
title: Channel released while not detached
summary: A 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](https://ably.com/docs/channels/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.
5 changes: 5 additions & 0 deletions protocol/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,11 @@
"title": "Too many channels",
"summary": "An operation was rejected because it would exceed the maximum number of channels permitted, either the channels attached to a single connection or those included in a single batch request."
},
"90011": {
"identifier": "channel_release_invalid_state",
"title": "Channel released while not detached",
"summary": "A 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."
},
"90021": {
"identifier": "rate_limit_exceeded_account_channel_creation",
"title": "Account-wide channel creation rate exceeded",
Expand Down
Loading