{"record":{"id":"cde669cb3ab77e5f","repo":"FujiwaraChoki/MoneyPrinterV2","slug":"request-to-post-bridge-failed-last-exception","errorCode":null,"errorMessage":"Request to Post Bridge failed: {last_exception}","messagePattern":"Request to Post Bridge failed: (.+?)","errorType":"http","errorClass":"PostBridgeClientError","httpStatus":null,"severity":"error","filePath":"src/classes/PostBridge.py","lineNumber":250,"sourceCode":"                )\n            except requests.RequestException as exc:\n                last_exception = exc\n                if attempt == self._max_retries:\n                    break\n                time.sleep(0.5 * attempt)\n                continue\n\n            if response.status_code in expected_statuses:\n                return response\n\n            if (\n                response.status_code in self.RETRYABLE_STATUS_CODES\n                and attempt < self._max_retries\n            ):\n                time.sleep(0.5 * attempt)\n                continue\n\n            raise PostBridgeClientError(\n                self._build_http_error(response),\n                status_code=response.status_code,\n            )\n\n        raise PostBridgeClientError(\n            f\"Request to Post Bridge failed: {last_exception}\",\n        ) from last_exception\n\n    def _build_http_error(self, response: requests.Response) -> str:\n        try:\n            response_json = response.json()\n        except ValueError:\n            response_json = None\n\n        details = None\n\n        if isinstance(response_json, dict):\n            if isinstance(response_json.get(\"error\"), list):","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/FujiwaraChoki/MoneyPrinterV2/blob/5192af8eca97759f941834b947e3ceb209da0649/src/classes/PostBridge.py#L232-L268","documentation":"Raised by PostBridgeClient._request when every retry attempt fails with a transport-level exception (connection error, timeout, TLS failure) so there is no HTTP response to inspect. The last underlying exception is chained into the message for diagnosis.","triggerScenarios":"Network offline, DNS resolution failure for the API host, connection refused (service down), TLS certificate errors, or read timeouts exceeding the retry budget across all attempts.","commonSituations":"Local machine loses connectivity, corporate proxy blocking the API host, DNS misconfiguration, the API endpoint temporarily down, or an over-aggressive timeout on large media uploads.","solutions":["Check basic connectivity: curl the API base URL from the same machine","Inspect the chained last_exception (DNS? TLS? timeout?) to narrow the cause","Increase timeout / max_retries for large uploads that time out on slow links","Configure proxy settings if a corporate network intercepts traffic"],"exampleFix":"// before\nraise PostBridgeClientError(f\"Request to Post Bridge failed: {last_exception}\")\n\n// after\nraise PostBridgeClientError(\n    f\"Request to Post Bridge failed after {self._max_retries} attempts: \"\n    f\"{type(last_exception).__name__}: {last_exception}\"\n) from last_exception","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    client.create_post(...)\nexcept PostBridgeClientError as exc:\n    if \"Request to Post Bridge failed\" in str(exc):\n        # transport-level failure: back off and retry once after connectivity check\n        time.sleep(10)\n        client.create_post(...)\n    else:\n        raise","preventionTips":["Rely on the client's built-in retry budget; tune _max_retries/timeout for large uploads","Monitor DNS and TLS health of the API host in long-running jobs","Wrap crossposting jobs in an outer retry-with-backoff to survive transient outages"],"tags":["python","api-client","network","retry"],"backgroundTag":"connection-failed","analyzedSha":"5192af8eca97759f941834b947e3ceb209da0649","analyzedAt":"2026-08-28T10:31:46.474Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}