Repository navigation
fix(sqs): raise QueueDoesNotExist, not the legacy NonExistentQueue (#413) - #426
Merged
Merged
Conversation
) SQS returned "AWS.SimpleQueueService.NonExistentQueue" for an operation naming an absent queue. AWS documents the error as QueueDoesNotExist, and the dotted form appears nowhere in the current API reference: SQS is an awsQueryCompatible JSON service, and that string is the query-compatibility alias AWS sends in an x-amzn-query-error header rather than in __type. The code decides whether a consumer can catch the error as a typed exception at all. Verified against both SDKs rather than assumed: - botocore derives the exception class from the resolved error code. Running its real parser plus errorfactory, __type of the legacy string resolves to a bare ClientError, so `except sqs.exceptions.QueueDoesNotExist` never matches; "QueueDoesNotExist" resolves to the modeled class. - aws-sdk-go-v2/service/sqs dispatches on strings.EqualFold("QueueDoesNotExist", errorCode), and the legacy string appears nowhere in the module, so errors.As(err, &types.QueueDoesNotExist{}) never matched either. So a consumer's retry loop could not be written idiomatically against substrate — which is the defect #413 exists to fix, one layer down. This must land before the seedable consistency window, whose tests assert the code the seeded window returns. Changing the code alone corrects both SDKs with no new plumbing, because writeError already derives x-amzn-ErrorType from Code. Deliberately not adding an x-amzn-query-error header: that would need a cross-cutting change to the shared AWSError type for one service's legacy alias and would still leave Error["Code"] reading the legacy string. Gating on x-amzn-query-mode is not viable either — botocore always sends it for a query-compatible service, but it appears nowhere in the Go SDK, so gating would silently disable the header for every Go caller. The 14 verbatim duplicates collapse into one sqsQueueDoesNotExist helper, so every future queue operation inherits the right code. The existing test asserted only StatusCode, which is exactly why the wrong code survived this long. It now asserts __type, Code, message and the x-amzn-ErrorType header, and a new table covers all 12 operations that can raise it under both protocols — 24 subtests, which is also the evidence the dedup missed no site. No query-protocol XML assertion: errorProtocolFor consults the service map before the Content-Type and sqs is registered as errProtoJSONRPC, so SQS errors are always JSON. Both protocol rows assert the same JSON shape deliberately; whether that itself is a fidelity gap is noted on the issue. Part A of #413; the seedable consistency window follows separately. Does not close the issue.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Aug 1, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part A of #413. The seedable consistency window follows in a separate PR; this
one deliberately does not close the issue.
What
SQS returned
AWS.SimpleQueueService.NonExistentQueuefor an operation naming anabsent queue. AWS documents the error as
QueueDoesNotExist, and the dottedform appears nowhere in the current API reference: SQS is an
awsQueryCompatibleJSON service, and that string is the query-compatibility alias AWS sends in an
x-amzn-query-errorheader — not in__type.Why this is in #413's scope rather than a follow-up
The code decides whether a consumer can catch the error as a typed exception at
all. Verified against both SDKs rather than assumed:
errorfactory: the legacy string resolves to a bareClientError, soexcept sqs.exceptions.QueueDoesNotExistnever matches."QueueDoesNotExist"resolves to the modeled class.deserializers.godispatches onstrings.EqualFold("QueueDoesNotExist", errorCode). The legacy string appears nowhere in thesqsmodule, soerrors.As(err, &types.QueueDoesNotExist{})never matched either.So the retry loop #413 asks for could not be written idiomatically against
substrate regardless of the seed — shipping the seed on the current code would
reproduce the very defect the issue exists to fix, one layer down. This must land
first, since Part B's tests assert the code the seeded window returns.
Wire shape: change the code, don't add the compat header
writeErroralready derivesx-amzn-ErrorTypefromCode, so changing the codealone corrects both SDKs with no new plumbing.
Adding
x-amzn-query-errorwould need a cross-cutting change to the sharedAWSErrortype for one service's legacy alias, and would still leaveError["Code"]reading the legacy string. Gating onx-amzn-query-modeis notviable either: botocore always sends it for a query-compatible service, but it
appears nowhere in the Go SDK — gating would silently disable the header for every
Go caller, substrate's primary consumer language.
Changes
The 14 byte-identical duplicates collapse into one
sqsQueueDoesNotExisthelper(new
emulator/sqs_errors.go), doc-commented with the AWS citation and theSDK reasoning, so every future queue operation inherits the right code.
Tests
TestSQSPlugin_JSON_Error_NonExistentQueueasserted onlyStatusCode— whichis precisely why the wrong code survived this long. It now asserts
__type,Code,messageand thex-amzn-ErrorTypeheader.New
TestSQS_QueueDoesNotExist_AllOperationscovers all 12 operations that canraise it, under both protocols — 24 subtests, which is also the evidence the
dedup missed no site.
Verified the tests can fail: restoring the legacy code string fails both.
No query-protocol XML assertion.
errorProtocolForconsults the service mapbefore the Content-Type and
sqsis registered aserrProtoJSONRPC, so SQS errorsare always JSON — an XML assertion would fail. Both protocol rows assert the same
JSON shape deliberately; whether that is itself a fidelity gap is noted on the
issue rather than changed here.
Compatibility
The legacy string appears nowhere else in this repo (the only other match was a
test function name), nowhere in botocore's model, and nowhere in
aws-sdk-go-v2/service/sqs. The message text is only ever produced, neverasserted on.
Verification
gofmtclean ·go build ./...·go vet ./...·golangci-lint run ./...(0issues) ·
make test(race) ·make docs-reference-check·test/e2e— all green.