Skip to content

Commit 15fa221

Browse files
authored
fix(sdk): match invalid checkpoint token casing (#723)
* fix: match invalid checkpoint token casing Service emits "Invalid checkpoint token" (lowercase). The SDK compared with a Title Case prefix, so stale tokens were treated as non-retryable execution failures. Compare case-insensitively and cover both casings in unit tests. Fixes #721 * fix: use exact Invalid checkpoint token match Match the backend error prefix case-sensitively and restore the single-unit test description preferred in review.
1 parent 5a09149 commit 15fa221

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/aws-durable-execution-sdk-python/src/aws_durable_execution_sdk_python/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
TOO_MANY_REQUESTS_ERROR: int = 429
1414
SERVICE_ERROR: int = 500
1515
INVALID_PARAMETER_VALUE_EXCEPTION: str = "InvalidParameterValueException"
16-
INVALID_CHECKPOINT_TOKEN_PREFIX: str = "Invalid Checkpoint Token"
16+
INVALID_CHECKPOINT_TOKEN_PREFIX: str = "Invalid checkpoint token"
1717

1818
# Non-retryable customer error codes that arrive as non-4xx (e.g. HTTP 502) from Lambda.
1919
# Unlike typical 5xx errors, these require customer intervention (e.g., fixing
@@ -162,7 +162,7 @@ def _classify_error_category(
162162
These arrive as HTTP 502 but require customer intervention to fix.
163163
- 4xx errors → EXECUTION, except:
164164
- 429 (TooManyRequests) → INVOCATION (throttling is transient)
165-
- InvalidParameterValueException with "Invalid Checkpoint Token" → INVOCATION
165+
- InvalidParameterValueException with "Invalid checkpoint token" (exact match) → INVOCATION
166166
(stale token from a concurrent checkpoint; next invocation gets a fresh token)
167167
- 5xx, network errors → INVOCATION
168168
"""

packages/aws-durable-execution-sdk-python/tests/exceptions_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def test_checkpoint_error():
6666

6767

6868
def test_checkpoint_error_classification_invalid_token_invocation():
69-
"""Test 4xx InvalidParameterValueException with Invalid Checkpoint Token is invocation error."""
69+
"""Test 4xx InvalidParameterValueException with "Invalid checkpoint token" error message is an invocation error."""
7070
error_response = {
7171
"Error": {
7272
"Code": "InvalidParameterValueException",
73-
"Message": "Invalid Checkpoint Token: token expired",
73+
"Message": "Invalid checkpoint token: token expired",
7474
},
7575
"ResponseMetadata": {"HTTPStatusCode": 400},
7676
}

0 commit comments

Comments
 (0)