From 4f81a41186b1052f8c7b8d3375f3735b30a125ab Mon Sep 17 00:00:00 2001 From: Simon Woolf Date: Fri, 9 Oct 2026 03:57:00 +0100 Subject: [PATCH] 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 ae7d6f93..00d2a4b0 100644 --- a/protocol/errors.json +++ b/protocol/errors.json @@ -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",