{"record":{"id":"23affd3c0b858097","repo":"HKUDS/Vibe-Trading","slug":"network-error-last-exc","errorCode":null,"errorMessage":"network error: {last_exc}","messagePattern":"network error: (.+?)","errorType":"exception","errorClass":"EtoroAPIError","httpStatus":null,"severity":"error","filePath":"agent/src/trading/connectors/etoro/client.py","lineNumber":342,"sourceCode":"            if response.status_code == 429 and allow_retry and attempt + 1 < attempts:\n                retry_after = response.headers.get(\"Retry-After\")\n                delay = float(retry_after) if retry_after else backoff[min(attempt, len(backoff) - 1)]\n                time.sleep(delay)\n                continue\n\n            if response.status_code >= 400:\n                detail = _response_error_body(response)\n                raise EtoroAPIError(f\"HTTP {response.status_code}: {detail}\")\n\n            if not response.content:\n                return {}\n            try:\n                return response.json()\n            except ValueError as exc:\n                raise EtoroAPIError(f\"invalid JSON response: {exc}\") from exc\n\n        if last_exc is not None:\n            raise EtoroAPIError(f\"network error: {last_exc}\")\n        raise EtoroAPIError(\"request failed without response\")\n\n\ndef _build_default_client(cfg: EtoroConfig) -> EtoroClient:\n    \"\"\"Build the production HTTP client for one eToro configuration.\"\"\"\n    return EtoroClient(cfg)\n\n\n_default_client_factory: Callable[[EtoroConfig], EtoroClient] = _build_default_client\n\n\ndef make_client(cfg: EtoroConfig) -> EtoroClient:\n    \"\"\"Build the REST client for a config (tests may override via ``set_client_factory``).\"\"\"\n    return _default_client_factory(cfg)\n\n\ndef set_client_factory(\n    factory: Callable[[EtoroConfig], EtoroClient] | None = None,","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/etoro/client.py#L324-L360","documentation":"Raised by EtoroClient.request after it exhausted its retry loop: at least one attempt raised a network-level exception (recorded in last_exc) and no usable response was ever obtained.","triggerScenarios":"DNS failure, connection refused, TLS error, or timeout on every retry attempt of any eToro API call — e.g. no internet, firewall blocking the eToro host, or the endpoint being temporarily down.","commonSituations":"Offline dev machine, corporate proxy blocking outbound HTTPS, VPN interference, transient eToro API outage, mistyped host configuration.","solutions":["Check the chained exception (raise ... from exc) for the underlying cause (DNS? refused? timeout?)","Verify network connectivity / curl the eToro API host","Configure proxy environment variables if behind a corporate proxy","Retry with exponential backoff for transient outages"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import socket\nsocket.gethostbyname(host)  # fail fast on DNS issues","typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        return client.request('GET', path)\n    except EtoroAPIError as exc:\n        if 'network error' not in str(exc) or attempt == 2:\n            raise\n    time.sleep(2 ** attempt)","preventionTips":["Wrap eToro calls in retry with exponential backoff for network errors","Monitor connectivity to the eToro host before long batch jobs","Inspect __cause__ of the raised error for the real network failure"],"tags":["etoro","network","timeout","retry"],"backgroundTag":"network-request-failed","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}