Skip to content

Register routing-layer error codes 50205, 50305, 50306, 50405 - #265

Merged
JoaoDiasAbly merged 1 commit into
mainfrom
support/REA-2121
Jul 29, 2026
Merged

Register routing-layer error codes 50205, 50305, 50306, 50405#265
JoaoDiasAbly merged 1 commit into
mainfrom
support/REA-2121

Conversation

@JoaoDiasAbly

@JoaoDiasAbly JoaoDiasAbly commented Oct 14, 2024

Copy link
Copy Markdown
Contributor

https://ably.atlassian.net/browse/REA-2121

Reworked from the original one-line edit of protocol/errors.json (which is now generated and must not be edited by hand) to the current registration process: one Markdown file per code in errors/codes/, with protocol/errors.json regenerated via npm run generate:errors.

Registers the four codes raised by the frontdoor router's serveError path (verified against realtime go/realtime/roles/frontdoor/router/request_handler.go):

Code HTTP Raised when
50205 502 the router could not connect to the upstream service (connection refused)
50305 503 the router hit an unexpected error handling the request (default case)
50306 503 the target region is administratively disabled (rejectForSiteDisabled)
50405 504 the router timed out waiting for the upstream service

50205 and 50405 are included per @lmars's review; 50306 is raised in the same switch and was also unregistered, so it is included too.

Bodies

Per @lmars's latest review, all four codes now carry a detail-page body in the three-section format used by #352 (What you should doWhy it happensWhat you'll see). Facts were checked against source rather than written from memory:

  • Message strings and HTTP statuses come from serveError in request_handler.go.
  • Retry guidance comes from the SDK spec: a 500 <= code <= 504 response or a request timeout qualifies for a retry against a fallback endpoint (RSC15l), so for 50205/50305/50405 the answer is "usually nothing, the SDK retries".
  • 50306 is the exception, and its body leads with the split: on the main endpoint a retry lands on a healthy region, but an endpoint that names a region has no fallbacks outside it (REC2c2/REC2c4), so the request keeps failing until the region is re-enabled. The pre-existing 50306 body was also rewritten to satisfy the no-em-dash rule added to errors/guidelines.md in errors: Add bodies for all error codes with an FAQ page #352.
  • 50405 notes that a timed-out publish may still have been processed, and that REST publishes are idempotent by default from SDK v1.2 (TO3n), so an automatic retry cannot duplicate the message.

Scope stays on this PR's four codes: the sibling edge-proxy codes (50010, 50210, 50310, 50410) are still body-less on main and belong to the wider sweep.

protocol/errorsHelp.json already contains an entry for 50305 (added separately in 2288fb9), so no change is needed there. Rebased onto main and squashed to a single commit; npm run lint, validate:errors, validate:errors-json, the generate:errors drift check and npm test all pass locally.

🤖 Generated with Claude Code

@JoaoDiasAbly
JoaoDiasAbly requested a review from lmars October 14, 2024 08:01
Comment thread protocol/errors.json Outdated

"50010": "Ably's edge proxy service has encountered an unknown internal error whilst processing the request",
"50210": "Ably's edge proxy service received an invalid (bad gateway) response from the Ably platform",
"50305": "Ably's routing layer was unable to service this request",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add 50205 and 50405 too, which are also set by the router in a similar place to 50305.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — 50205 and 50405 are now included, along with 50306 which is raised in the same serveError switch and was also unregistered.

@lmars

lmars commented Jul 9, 2026

Copy link
Copy Markdown
Member

@JoaoDiasAbly I know this is an old one, but if we still think it's something we want to merge, it needs to be updated to now register the codes by creating a Markdown file in the errors/codes directory.

@JoaoDiasAbly JoaoDiasAbly changed the title Add error 50305 to errors.json Register routing-layer error codes 50205, 50305, 50306, 50405 Jul 22, 2026
@JoaoDiasAbly

Copy link
Copy Markdown
Contributor Author

Reworked to the new registration process: the four codes are now registered as Markdown files in errors/codes/ and protocol/errors.json is regenerated from the registry (no hand edits). Branch was reset onto main, so the conflict is gone. Updated the PR description with the details.

@JoaoDiasAbly
JoaoDiasAbly requested a review from lmars July 23, 2026 11:34
Comment thread errors/codes/50205.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind giving Claude a stab at writing the bodies too? I'm currently working on the bodies for all existing codes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR where I've added a bunch of body text: #352

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@JoaoDiasAbly
JoaoDiasAbly force-pushed the support/REA-2121 branch 2 times, most recently from d5abd0d to 96241e8 Compare July 27, 2026 16:57
@JoaoDiasAbly
JoaoDiasAbly requested a review from lmars July 27, 2026 17:00
Comment thread errors/codes/50306.md Outdated

## What you should do

On the main endpoint (the default), usually nothing: traffic is directed away from a disabled region, and SDK retries reach a healthy one. On a [region-specific endpoint](https://ably.com/docs/platform/account/enterprise-customization#regional-routing-and-storage), switch to the main endpoint: that endpoint pins every attempt to the named region, including retries, so requests keep failing while it is disabled. If your application has to stay pinned to a region, [contact Ably support](https://ably.com/support).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bad advice, if the customer is using a region-specific endpoint it's typically because they have a regional placement constraint, so if they switch to the main endpoint and hit regions their account is not permitted in, then they'll get errors.

Also, customers don't "pin to a region", the regional routing pins to a geographic area spanning multiple regions, so the advice here should be similar to 50305, the SDK will retry and traffic will eventually stop hitting the disabled region (as we would have taken it out of DNS).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... That makes sense, thanks for calling it out. Fixed now

Comment thread errors/codes/50306.md Outdated

## Why it happens

Ably occasionally takes a region out of service temporarily, for example to protect the platform during an incident. A disabled region rejects the requests that reach it rather than redirecting them elsewhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's never to protect the platform, it's always to prevent disruption when services in a region are not functioning correctly, often due to reasons outside out control.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlooked that wording, thanks. Fixed

These codes are raised by the frontdoor router's serveError path when it
cannot complete a request: connection refused upstream (50205), an
unexpected error (50305), the target region being administratively
disabled (50306), and an upstream timeout (50405).

Registered via one Markdown file per code in errors/codes/, per the
current registration process; protocol/errors.json is regenerated from
the registry.

Each code carries a detail-page body in the three-section format from
errors/guidelines.md. Message strings and HTTP statuses are taken from
the raising code in the realtime repo, and the retry guidance from the
SDK spec: a 500-504 response or a request timeout qualifies for a retry
against a fallback endpoint (RSC15l), an endpoint that names a region
has no fallbacks outside it (REC2c2), and REST publishes are idempotent
by default from SDK v1.2 (TO3n), so an automatic retry cannot duplicate
a message.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JoaoDiasAbly
JoaoDiasAbly requested a review from lmars July 29, 2026 11:14
@JoaoDiasAbly
JoaoDiasAbly merged commit c97e22c into main Jul 29, 2026
2 checks passed
@JoaoDiasAbly
JoaoDiasAbly deleted the support/REA-2121 branch July 29, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants