{"id":"03ab8574238f2536","repo":"python-poetry/poetry","slug":"failed-http-request-method-upper-url","errorCode":null,"errorMessage":"Failed HTTP request: {method.upper()} {url}","messagePattern":"Failed HTTP request: (.+?) (.+?)","errorType":"http","errorClass":"PoetryError","httpStatus":null,"severity":"error","filePath":"src/poetry/utils/authenticator.py","lineNumber":280,"sourceCode":"                            debug=True,\n                        )\n                    )\n                    raise exc\n            else:\n                if resp.status_code not in STATUS_FORCELIST or is_last_attempt:\n                    if raise_for_status:\n                        resp.raise_for_status()\n                    return resp\n\n            if not is_last_attempt:\n                attempt += 1\n                delay = self._get_backoff(resp, attempt)\n                logger.debug(\"Retrying HTTP request in %s seconds.\", delay)\n                time.sleep(delay)\n                continue\n\n        # this should never really be hit under any sane circumstance\n        raise PoetryError(f\"Failed HTTP request: {method.upper()} {url}\")\n\n    def _get_backoff(self, response: requests.Response | None, attempt: int) -> float:\n        if response is not None:\n            retry_after = response.headers.get(RETRY_AFTER_HEADER, \"\")\n            if retry_after:\n                return float(retry_after)\n\n        return 0.5 * attempt\n\n    def get(self, url: str, **kwargs: Any) -> requests.Response:\n        return self.request(\"get\", url, **kwargs)\n\n    def head(self, url: str, **kwargs: Any) -> requests.Response:\n        kwargs.setdefault(\"allow_redirects\", False)\n        return self.request(\"head\", url, **kwargs)\n\n    def post(self, url: str, **kwargs: Any) -> requests.Response:\n        return self.request(\"post\", url, **kwargs)","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/python-poetry/poetry/blob/92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54/src/poetry/utils/authenticator.py#L262-L298","documentation":"A defensive PoetryError raised at the end of Authenticator.request if the request loop exits without returning a response or having raised (authenticator.py:279-280). The inline comment states 'this should never really be hit under any sane circumstance', so encountering it indicates either an unexpected code path, a logic gap in the retry/status handling, or an exotic retry-config edge case rather than a normal network failure.","triggerScenarios":"Authenticator.request(...) terminates its loop without hitting a return or raise — theoretically unreachable given the retry logic; could surface with unusual STATUS_FORCELIST/retry configuration or a code regression.","commonSituations":"Essentially never in normal use; if seen, suspect a bug in Poetry or a heavily customized authenticator/retry setup.","solutions":["Retry the originating command once — if it persists, it is likely a bug.","Check for any custom Authenticator subclass or monkey-patching of STATUS_FORCELIST/retry params.","Report the issue upstream with the method, URL, and Poetry version, since this path is meant to be unreachable.","Work around by configuring credentials/URLs so the normal response path is taken."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from poetry.exceptions import PoetryError\nfor attempt in range(3):\n    try:\n        resp = authenticator.request(method, url)\n        break\n    except PoetryError as e:\n        if \"Failed HTTP request\" in str(e) and attempt < 2:\n            time.sleep(2 ** attempt)\n            continue\n        raise","preventionTips":["Since this path is meant to be unreachable, report it upstream if seen.","Avoid subclassing/patching Authenticator retry logic unless necessary.","Keep authenticator configuration (STATUS_FORCELIST, retries) at sane defaults."],"tags":["network","http","authenticator","unreachable","bug"],"analyzedSha":"92b74dcfe348d0e01e14d40d6c1fa47a4ee04a54","analyzedAt":"2026-08-04T20:33:34.072Z","schemaVersion":2}