HKUDS/Vibe-Trading · error · EtoroAPIError
network error: {last_exc}
Error message
network error: {last_exc} What it means
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.
Source
Thrown at agent/src/trading/connectors/etoro/client.py:342
if response.status_code == 429 and allow_retry and attempt + 1 < attempts:
retry_after = response.headers.get("Retry-After")
delay = float(retry_after) if retry_after else backoff[min(attempt, len(backoff) - 1)]
time.sleep(delay)
continue
if response.status_code >= 400:
detail = _response_error_body(response)
raise EtoroAPIError(f"HTTP {response.status_code}: {detail}")
if not response.content:
return {}
try:
return response.json()
except ValueError as exc:
raise EtoroAPIError(f"invalid JSON response: {exc}") from exc
if last_exc is not None:
raise EtoroAPIError(f"network error: {last_exc}")
raise EtoroAPIError("request failed without response")
def _build_default_client(cfg: EtoroConfig) -> EtoroClient:
"""Build the production HTTP client for one eToro configuration."""
return EtoroClient(cfg)
_default_client_factory: Callable[[EtoroConfig], EtoroClient] = _build_default_client
def make_client(cfg: EtoroConfig) -> EtoroClient:
"""Build the REST client for a config (tests may override via ``set_client_factory``)."""
return _default_client_factory(cfg)
def set_client_factory(
factory: Callable[[EtoroConfig], EtoroClient] | None = None,View on GitHub (pinned to 80ffdda44c)
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
Defensive patterns
Strategy: retry
Validate before calling
import socket socket.gethostbyname(host) # fail fast on DNS issues
Try / catch
for attempt in range(3):
try:
return client.request('GET', path)
except EtoroAPIError as exc:
if 'network error' not in str(exc) or attempt == 2:
raise
time.sleep(2 ** attempt) Prevention
- 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
When it happens
Trigger: 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.
Common situations: Offline dev machine, corporate proxy blocking outbound HTTPS, VPN interference, transient eToro API outage, mistyped host configuration.
Related errors
- Slack Socket Mode WebSocket connect timed out
- Trading 212 request failed: {exc}
- signal-cli daemon check returned status {response.status_cod
- signal-cli daemon not responding: {e}
- Signal SSE stream ended unexpectedly
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/23affd3c0b858097.
Report an issue: GitHub.