Conversation
Diaoul
force-pushed
the
fix/map-quota-exceeded-to-rate-limit
branch
from
September 27, 2026 22:04
922d8d4 to
ad4f06c
Compare
The cloud reports its polling quota as errorCode QUOTA_EXCEEDED with the message "Too many requests, try again later". That code appears in none of the three error maps, so check_response falls through to the generic `raise OverkizError(result)` and callers cannot tell rate limiting from an unknown server error without matching on the payload text. TooManyRequestsError was reachable only for AUTHENTICATION_ERROR carrying the same message, which is the login path, not polling. Key off the errorCode rather than the message: the code is the API's machine-readable contract, while the message is prose that can be reworded, recased or localised without the API changing. QUOTA_EXCEEDED is unambiguous on its own, so it belongs with the other sole-discriminator codes rather than in the message fallback map, which exists for codes that vary. Fixes iMicknl#2263 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diaoul
force-pushed
the
fix/map-quota-exceeded-to-rate-limit
branch
from
September 27, 2026 22:19
ad4f06c to
96efaef
Compare
Diaoul
commented
Sep 27, 2026
| @@ -0,0 +1,4 @@ | |||
| { | |||
| "errorCode": "QUOTA_EXCEEDED", | |||
| "error": "Quota exceeded" | |||
Author
There was a problem hiding this comment.
This is mostly for demonstration purposes, I did not observe that in real conditions with my integration. The message always was Too many requests, try again later.
Let me know if I should remove this "fake" test.
This branch has not been deployed
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.
Fixes #2263
🐛 Problem
errorCode: QUOTA_EXCEEDED, message"Too many requests, try again later".check_responsefalls through toraise OverkizError(result).TooManyRequestsErrorwas reachable only via("AUTHENTICATION_ERROR", "Too many requests", ...)— the login path, not polling.✅ Fix
One entry, among the codes that are already their own sole discriminator:
_MESSAGE_FALLBACK_MAP— that map exists "for responses where the errorCode alone is not enough or may vary across API versions", andQUOTA_EXCEEDEDis unambiguous on its own._ERROR_CODE_MESSAGE_MAPis consulted first and the existing("AUTHENTICATION_ERROR", "Too many requests", …)login entry is untouched, so nothing that resolves today changes — this only types responses that were falling through.Behaviour, verified against
check_response:QUOTA_EXCEEDED+"Too many requests, try again later"OverkizErrorQUOTA_EXCEEDED+ any other messageQUOTA_EXCEEDED+ noerrorfieldAUTHENTICATION_ERROR+"Too many requests"(login)AUTHENTICATION_ERROR+"Bad credentials"BadCredentialsError📊 Why it matters
Measured on an Atlantic Cozytouch V2 hub (cloud API) via Home Assistant's
overkizintegration, eight commands issued in parallel to eight heaters:fetch_eventsrate during the burstQUOTA_EXCEEDEDraisedBecause the error arrived untyped, the consumer's back-off — which keys on
TooManyRequestsError— never ran. It kept polling at the interval that hit the limit, surfaced a full traceback as an unexpected error, and the failed update marked every entity unavailable, after which Home Assistant refused the remaining three service calls outright.🧪 Tests
Two fixtures added, both wired into the existing
check_responseparametrisation intests/test_client.py:quota-exceeded.json— the payload as the cloud sends itquota-exceeded-other-message.json— same code, different prose, so the assertion pins the code path rather than the wording645 passed, 2 skipped;mypyclean;ruff checkandruff format --checkclean on both touched files.The 3 pre-existing
ruff checkfindings and 5 unformatted files onmainare untouched.