Panniantong/Agent-Reach · error · TranscribeError
{provider}: network error: {e}
Error message
{provider}: network error: {e} What it means
Raised by transcribe_chunk (transcribe.py:389-390) when the requests.post to the provider endpoint throws requests.RequestException — connection failures, DNS errors, TLS problems, or the 120s default request timeout (requests.Timeout is a RequestException subclass). The original exception is chained via `from e`.
Source
Thrown at agent_reach/transcribe.py:390
key = _provider_key(provider, cfg)
if not key:
raise NoProviderConfigured(
f"{provider}: missing {PROVIDERS[provider]['key_field']} "
f"(configure with `agent-reach configure {provider}-key ...`)"
)
info = PROVIDERS[provider]
with chunk.open("rb") as fh:
try:
resp = requests.post(
info["endpoint"],
headers={"Authorization": f"Bearer {key}"},
files={"file": (chunk.name, fh, "audio/m4a")},
data={"model": info["model"], "response_format": "text"},
timeout=timeout,
)
except requests.RequestException as e:
raise TranscribeError(f"{provider}: network error: {e}") from e
if not resp.ok:
raise TranscribeError(f"{provider}: HTTP {resp.status_code}: {resp.text[:300]}")
return resp.text
def _provider_order(provider: str) -> List[str]:
if provider == "auto":
return ["groq", "openai"]
if provider in PROVIDERS:
return [provider]
raise TranscribeError(f"unknown provider: {provider} (use groq|openai|auto)")
def transcribe(
source: str,
*,
provider: str = "auto",View on GitHub (pinned to 93ae1d18c3)
Solutions
- Retry with backoff — most occurrences are transient; wrap the call or enable provider='auto' + allow_provider_fallback=True in transcribe()
- If timeouts recur, pass a larger timeout: transcribe_chunk(chunk, 'groq', timeout=300)
- Check egress: curl -v https://api.groq.com/openai/v1/audio/transcriptions and proxy env (HTTPS_PROXY) in containers
- Verify DNS resolves: getent hosts api.groq.com
Example fix
# before
text = transcribe_chunk(chunk, "groq") # groq: network error: ...
# after: bounded retry with a longer upload window
import time
for attempt in range(3):
try:
text = transcribe_chunk(chunk, "groq", timeout=300)
break
except TranscribeError:
if attempt == 2:
raise
time.sleep(2 ** attempt) Defensive patterns
Strategy: retry
Validate before calling
import socket
from urllib.parse import urlparse
def provider_endpoint_reachable(endpoint: str, timeout: float = 5.0) -> bool:
p = urlparse(endpoint)
try:
socket.create_connection((p.hostname, p.port or 443), timeout=timeout).close()
return True
except OSError:
return False Try / catch
from agent_reach.transcribe import TranscribeError, transcribe_chunk
import time
def transcribe_with_retry(chunk, provider, attempts=3):
for i in range(attempts):
try:
return transcribe_chunk(chunk, provider, timeout=300)
except TranscribeError as e:
if "network error" not in str(e) or i == attempts - 1:
raise
time.sleep(2 ** i) Prevention
- Pass timeout=300 when uploading from slow uplinks
- Verify egress/proxy env (HTTPS_PROXY) in containers before batch jobs
- Reserve allow_provider_fallback=True (auto mode) as the resilience path
When it happens
Trigger: transcribe_chunk with default timeout=120 on a chunk upload that stalls (large chunk + slow uplink); DNS failure reaching api.groq.com/api.openai.com; corporate proxy intercepting TLS; connection reset by the provider edge.
Common situations: Uploading from bandwidth-constrained environments (10-min chunk at ~2.4 MB usually fits, but a fallback path sending an unsplit 24 MB compressed file can be slow); egress-firewalled containers missing proxy env vars; transient provider-side resets.
Related errors
- curl could not complete the V2EX TLS fallback
- ffprobe timed out while reading audio duration after {FFPROB
- {cmd[0]} timed out after {timeout}s
- unknown provider: {provider}
- {provider}: missing {PROVIDERS[provider]['key_field']} (conf
AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14).
Data as JSON: /api/errors/2d7df13e1ec4b89f.
Report an issue: GitHub.