{"record":{"id":"50b2ace7ec5b0e0f","repo":"python-telegram-bot/python-telegram-bot","slug":"two-args-req-format-name-http-version","errorCode":null,"errorMessage":"_TWO_ARGS_REQ.format(name, \"http_version\")","messagePattern":"_TWO_ARGS_REQ\\.format\\(name, \"http_version\"\\)","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/telegram/ext/_applicationbuilder.py","lineNumber":459,"sourceCode":"            timeouts.append(\"media_write_timeout\")\n\n        # Code below tests if it's okay to set a Request object. Only okay if no other request args\n        # or instances containing a Request were set previously\n        for attr in timeouts:\n            if not isinstance(getattr(self, f\"_{prefix}{attr}\"), DefaultValue):\n                raise RuntimeError(_TWO_ARGS_REQ.format(name, attr))\n\n        if not isinstance(getattr(self, f\"_{prefix}connection_pool_size\"), DefaultValue):\n            raise RuntimeError(_TWO_ARGS_REQ.format(name, \"connection_pool_size\"))\n\n        if not isinstance(getattr(self, f\"_{prefix}proxy\"), DefaultValue):\n            raise RuntimeError(_TWO_ARGS_REQ.format(name, \"proxy\"))\n\n        if not isinstance(getattr(self, f\"_{prefix}socket_options\"), DefaultValue):\n            raise RuntimeError(_TWO_ARGS_REQ.format(name, \"socket_options\"))\n\n        if not isinstance(getattr(self, f\"_{prefix}http_version\"), DefaultValue):\n            raise RuntimeError(_TWO_ARGS_REQ.format(name, \"http_version\"))\n\n        self._bot_check(name)\n\n        if self._updater not in (DEFAULT_NONE, None):\n            raise RuntimeError(_TWO_ARGS_REQ.format(name, \"updater instance\"))\n\n    def _request_param_check(self, name: str, get_updates: bool) -> None:\n        if get_updates and self._get_updates_request is not DEFAULT_NONE:\n            raise RuntimeError(  # disallow request args for get_updates if Request for that is set\n                _TWO_ARGS_REQ.format(f\"get_updates_{name}\", \"get_updates_request instance\")\n            )\n        if self._request is not DEFAULT_NONE:  # disallow request args if request is set\n            raise RuntimeError(_TWO_ARGS_REQ.format(name, \"request instance\"))\n\n        if self._bot is not DEFAULT_NONE:  # disallow request args if bot is set (has Request)\n            raise RuntimeError(\n                _TWO_ARGS_REQ.format(\n                    f\"get_updates_{name}\" if get_updates else name, \"bot instance\"","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/python-telegram-bot/python-telegram-bot/blob/d3b69d2e9fb7af6c796f84516cfda751752c7cb7/src/telegram/ext/_applicationbuilder.py#L441-L477","documentation":"Raised when builder.http_version(...) was set and you subsequently call request()/get_updates_request() with a Request instance. HTTP version selection and a custom Request cannot both be applied.","triggerScenarios":"builder.http_version('2') followed by builder.request(...) or builder.get_updates_request(...).","commonSituations":"Enabling HTTP/2, then adding a custom Request for other tuning; common after upgrading to v20+ where these methods became exclusive.","solutions":["Set http_version on the Request instance (HTTPXRequest(http_version='2')) and remove builder.http_version()","Or keep http_version() and avoid request()"],"exampleFix":"# before\nApplicationBuilder().token(T).http_version('2').request(HTTPXRequest())\n# after\nApplicationBuilder().token(T).request(HTTPXRequest(http_version='2'))","handlingStrategy":"validation","validationCode":"HTTPXRequest(http_version='2')  # requires the httpx[http2] extra","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install httpx[http2] and set http_version on the Request"],"tags":["python-telegram-bot","applicationbuilder","http2"],"backgroundTag":"builder-conflicting-configuration","analyzedSha":"d3b69d2e9fb7af6c796f84516cfda751752c7cb7","analyzedAt":"2026-08-28T16:18:54.805Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}