Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

QUOTA_EXCEEDED is not mapped to TooManyRequestsError, so rate limiting arrives untyped

オープン 初心者向け
#2,263 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 7 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

response_handler.py の3つのエラーマップと check_response から始め、特に60行目付近にある既存の TooManyRequestsError のマッピングを確認します。Issue にある FakeResp のケースを再現し、QUOTA_EXCEEDED レスポンスで汎用の OverkizError ではなく TooManyRequestsError が発生することを確認します。実際のレート制限レスポンスが、想定されるバックオフパスと一貫した型になることを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

🐛 The problem

The Overkiz cloud reports its polling quota with errorCode: QUOTA_EXCEEDED, which matches none of the three error maps in response_handler.py, so it falls through to the generic raise at the end of check_response:

pyoverkiz.exceptions.OverkizError: {'errorCode': 'QUOTA_EXCEEDED', 'error': 'Too many requests, try again later'}

TooManyRequestsError is only reachable for a different errorCode (response_handler.py:60):

("AUTHENTICATION_ERROR", "Too many requests", TooManyRequestsError),

So the one exception type that means "you are being rate limited" is never raised for the server's actual rate-limit response.

🔁 Reproduction

import asyncio
from pyoverkiz.response_handler import check_response
from pyoverkiz.exceptions import OverkizError, TooManyRequestsError

class FakeResp:
    status = 403
    url = "https://example/events/x/fetch"
    async def json(self, content_type=None):
        return {"errorCode": "QUOTA_EXCEEDED",
                "error": "Too many requests, try again later"}

async def main():
    try:
        await check_response(FakeResp())
    except TooManyRequestsError:
        print("typed")
    except OverkizError as err:
        print("untyped:", err)

asyncio.run(main())   # -> untyped: {'errorCode': 'QUOTA_EXCEEDED', ...}

Why none of the maps catch it:

  • _ERROR_CODE_MESSAGE_MAP (:47) — has no QUOTA_EXCEEDED entry
  • _MESSAGE_FALLBACK_MAP (:104) — has "Too many executions" and "Too many attempts with an invalid token", but not "Too many requests"
  • _ERROR_CODE_FALLBACK_MAP (:121) — only AUTHENTICATION_ERROR and RESOURCE_ACCESS_DENIED

📉 Why it matters

Callers cannot distinguish rate limiting from an unknown server error without string-matching the payload, so any back-off keyed on TooManyRequestsError silently never runs.

Measured on an Atlantic Cozytouch V2 hub (cloud API), eight commands issued in parallel to eight heaters, Home Assistant's overkiz integration:

observed
fetch_events rate during the burst 1.32 /s (documented limit: 1/s)
polling intervals under 1 s 5, shortest 0.23 s
QUOTA_EXCEEDED raised 1
commands that reached the hub 5 / 8

Because the error arrives untyped:

  • it surfaces as Unexpected error fetching device events data with a full traceback, rather than a handled rate-limit path
  • the coordinator keeps polling at the interval that hit the limit instead of slowing down
  • the failed update marks every entity unavailable, and Home Assistant then refuses the remaining service calls — Referenced entities ... are missing or not currently available — so three commands were silently dropped
  • worst state-delivery lag in that run was 28.97 s

✅ Suggested fix

Either map the code directly in _ERROR_CODE_MESSAGE_MAP:

("QUOTA_EXCEEDED", None, TooManyRequestsError),

…or, more robustly, add the message to _MESSAGE_FALLBACK_MAP so it matches whatever errorCode carries it:

("Too many requests", TooManyRequestsError),

The second also covers the existing AUTHENTICATION_ERROR variant, and any future code the cloud attaches to the same message.

🧾 Environment

  • pyoverkiz 2.1.0
  • Hub: Atlantic Cozytouch V2 (io://****-****-9776), cloud API — local API not available for this server
  • Seen on the events/{listener_id}/fetch endpoint, documented as "1 calls per 1 SECONDS period for this particular operation (polling)"

Happy to open a PR for whichever form you prefer.

主要言語
Python
スター
58
フォーク
35
平均マージ
3日 15時間
マージ済み PR(30日)
20

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

iMicknl/python-overkiz-api のほかの issue

iMicknl/python-overkiz-api の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。