From 9b822860c536abc58cff1dcfe74675fa47db9add Mon Sep 17 00:00:00 2001 From: Simon Woolf Date: Fri, 9 Oct 2026 03:57:00 +0100 Subject: [PATCH 1/2] errors: Add 90011 "Channel released while not detached" Raised by SDKs when Channels#release() is called on a channel that is not in the initialized, detached or failed state (spec RTS4e). Co-Authored-By: Claude Opus 5.5 (1M context) --- errors/codes/90011.md | 20 ++++++++++++++++++++ protocol/errors.json | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 errors/codes/90011.md diff --git a/errors/codes/90011.md b/errors/codes/90011.md new file mode 100644 index 00000000..646f2832 --- /dev/null +++ b/errors/codes/90011.md @@ -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. diff --git a/protocol/errors.json b/protocol/errors.json index a2827407..99b158ce 100644 --- a/protocol/errors.json +++ b/protocol/errors.json @@ -1002,6 +1002,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", From 3ef17ec224cc1eae8202de5869e65a8c2068939e Mon Sep 17 00:00:00 2001 From: Simon Woolf Date: Tue, 27 Oct 2026 17:15:34 +0000 Subject: [PATCH 2/2] add note on release to 90001 --- errors/codes/90001.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errors/codes/90001.md b/errors/codes/90001.md index 1f0095f6..a61e4446 100644 --- a/errors/codes/90001.md +++ b/errors/codes/90001.md @@ -11,7 +11,7 @@ Refer to the [channel's state](https://ably.com/docs/channels/states) and its er ## Why it happens -The operation is only valid in certain channel states, and the channel was in a different one. Common cases are performing an action on a channel that is not currently attached, detaching a channel that has failed, or releasing a channel that could still receive updates. +The operation is only valid in certain channel states, and the channel was in a different one. Common cases are performing an action on a channel that is not currently attached, detaching a channel that has failed, or releasing a channel that could still receive updates (in some older SDKs; in current versions that last reason has its own error code, 90011). ## What you'll see