Skip to content

fix: suppress JSONDecodeError chain on empty HTTP 429 - #558

Open
alexander-nikitin-thenvoi wants to merge 5 commits into
mainfrom
cursor/empty-429-api-error-5a94
Open

fix: suppress JSONDecodeError chain on empty HTTP 429#558
alexander-nikitin-thenvoi wants to merge 5 commits into
mainfrom
cursor/empty-429-api-error-5a94

Conversation

@alexander-nikitin-thenvoi

@alexander-nikitin-thenvoi alexander-nikitin-thenvoi commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

JSONDecodeError traceback shown on empty 429 response bodies (#108)

Turns QA PR #557's test green. Empty ALB-style HTTP 429 (Content-Length: 0) on BandLinkagent_api_identity.get_agent_me now raises a clean ApiError with no JSONDecodeError in __cause__ / __context__ and no intermediate traceback.

Changes

  • Confirmed band-client-rest==0.0.26 (and 0.0.28) still raise ApiError(...) from JSONDecodeError without from None in generated get_agent_me. Bumping the pin does not fix this.
  • SDK-side wrap on the generated raw get_agent_me re-raises that ApiError with from None. Does not change Fern 429 retry behavior.

Related Issues

Fixes #108

Testing

  • uv run pytest tests/platform/test_rest_empty_429.py -v --no-cov (QA test: fail on JSONDecodeError chain from empty 429 (#108) #557 test; red-to-green)
  • uv run pytest tests/test_platform_runtime.py::TestStart::test_retries_metadata_fetch_on_rate_limit -v --no-cov
  • Unit tests pass (uv run pytest tests/ --ignore=tests/integration/ --ignore=tests/e2e/ — 4875 passed, 122 skipped)

Checklist

Open in Web Open in Cursor 

cursoragent and others added 5 commits August 23, 2026 07:06
Add a red-on-purpose pytest that hits get_agent_me through the real
BandLink REST client with an ALB-style empty 429 body. Asserts the
raised ApiError has no JSONDecodeError in __cause__/__context__ and
no JSONDecodeError in the formatted traceback.

Co-authored-by: Alexander Nikitin <alexander-nikitin-thenvoi@users.noreply.github.com>
Surface the dual JSONDecodeError/ApiError traceback in the pytest
failure message so the #108 symptom is visible in the red run.

Co-authored-by: Alexander Nikitin <alexander-nikitin-thenvoi@users.noreply.github.com>
band-client-rest==0.0.26 (and 0.0.28) re-raises ApiError from
JSONDecodeError without from None when get_agent_me sees an empty
error body. Wrap that generated method so callers get a clean ApiError.

Co-authored-by: Alexander Nikitin <alexander-nikitin-thenvoi@users.noreply.github.com>
Pyrefly rejects assigning a generic wrapper onto the generated
get_agent_me signature; setattr keeps the same pin-tied wrap.

Co-authored-by: Alexander Nikitin <alexander-nikitin-thenvoi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSONDecodeError traceback shown on empty 429 response bodies

2 participants