Skip to content

Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.

fix: SQS typed exceptions via correct error codes + XML Type element, bump to v1.1.6 — 694 (#35)

Nahuel Nuceraf34f0eb193b3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 872bbc55..3447d40d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,16 @@ Versioning follows [Semantic Versioning](https://semver.org/).
---
+## [1.1.6] — 2026-03-30
+
+### Fixed
+- **XML error responses** — added `<Type>Sender</Type>` (4xx) / `<Type>Receiver</Type>` (5xx) to all XML error responses in `sqs.py` and `core/responses.py` (used by S3, SNS, IAM, STS, CloudWatch). botocore requires this element to populate typed exception classes (e.g. `client.exceptions.QueueDoesNotExist`). Without it, botocore fell back to generic `ClientError` even when the error `Code` was correct.
+
+### Tests
+- 694 integration tests — all passing
+
+---
+
## [1.1.5] — 2026-03-30
### Fixed
diff --git a/ministack/services/sqs.py b/ministack/services/sqs.py
index 2d032249..ca3e9098 100644
--- a/ministack/services/sqs.py
+++ b/ministack/services/sqs.py
@@ -207,7 +207,7 @@ def _act_get_queue_url(data: dict, _u: str) -> dict:
name = data.get("QueueName", "")
url = _queue_name_to_url.get(name)
if not url:
- raise _Err("AWS.SimpleQueueService.NonExistentQueue",
+ raise _Err("QueueDoesNotExist",
"The specified queue does not exist.")
return {"QueueUrl": url}
@@ -448,7 +448,7 @@ def _act_send_message_batch(data: dict, qurl: str) -> dict:
_get_q(url)
entries = data.get("Entries", [])
if len(entries) > 10:
- raise _Err("AWS.SimpleQueueService.TooManyEntriesInBatchRequest",
+ raise _Err("TooManyEntriesInBatchRequest",
"Too many messages in a batch request. A maximum of 10 messages are allowed.")
ok: list = []
fail: list = []
@@ -551,7 +551,7 @@ _HANDLERS.update({
def _get_q(url: str) -> dict:
q = _queues.get(url)
if q is None:
- raise _Err("AWS.SimpleQueueService.NonExistentQueue",
+ raise _Err("QueueDoesNotExist",
"The specified queue does not exist for this wsdl version.")
return q
diff --git a/pyproject.toml b/pyproject.toml
index 4b49a7cc..d8f5a691 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "ministack"
-version = "1.1.5"
+version = "1.1.6"
description = "Free, open-source local AWS emulator — drop-in LocalStack replacement"
readme = "README.md"
license = { file = "LICENSE" }
diff --git a/tests/test_services.py b/tests/test_services.py
index 08b734ff..d904441a 100644
--- a/tests/test_services.py
+++ b/tests/test_services.py
@@ -624,7 +624,7 @@ def test_sqs_message_system_attributes(sqs):
def test_sqs_nonexistent_queue(sqs):
with pytest.raises(ClientError) as exc:
sqs.get_queue_url(QueueName="intg-sqs-does-not-exist")
- assert "NonExistentQueue" in exc.value.response["Error"]["Code"]
+ assert exc.value.response["Error"]["Code"] == "QueueDoesNotExist"
def test_sqs_receive_empty(sqs):
@@ -12151,7 +12151,7 @@ def test_sqs_send_message_batch_limit(sqs):
entries = [{"Id": str(i), "MessageBody": f"msg {i}"} for i in range(11)]
with pytest.raises(ClientError) as exc_info:
sqs.send_message_batch(QueueUrl=q, Entries=entries)
- assert exc_info.value.response["Error"]["Code"] == "AWS.SimpleQueueService.TooManyEntriesInBatchRequest"
+ assert exc_info.value.response["Error"]["Code"] == "TooManyEntriesInBatchRequest"
sqs.delete_queue(QueueUrl=q)
@@ -12178,3 +12178,17 @@ def test_dynamodb_batch_write_consumed_capacity(ddb):
assert resp["ConsumedCapacity"][0]["TableName"] == "batch-cap-regression"
assert resp["ConsumedCapacity"][0]["CapacityUnits"] == 1.0
ddb.delete_table(TableName="batch-cap-regression")
+
+
+# ---------------------------------------------------------------------------
+# Regression: XML error responses must include <Type>Sender/Receiver</Type>
+# so botocore populates typed exception classes (e.g. client.exceptions.QueueDoesNotExist).
+# Without <Type>, botocore falls back to generic ClientError.
+# ---------------------------------------------------------------------------
+
+def test_sqs_typed_exception_queue_not_found(sqs):
+ """client.exceptions.QueueDoesNotExist must be raised (not generic ClientError)
+ when accessing a non-existent queue — requires <Type> in the XML error response."""
+ import pytest
+ with pytest.raises(sqs.exceptions.QueueDoesNotExist):
+ sqs.get_queue_url(QueueName="queue-that-does-not-exist-typed-exc")