zeroclaw-labs/zeroclaw · error · anyhow::Error
Telnyx API error ({}): {}
Error message
Telnyx API error ({}): {} What it means
chat_with_system sent a chat completion to Telnyx and got a non-success status; the body is passed through sanitize_api_error to strip credentials before being embedded. The status code is included, so 401/400/429/500 each point at a distinct fix.
Source
Thrown at crates/zeroclaw-providers/src/telnyx.rs:206
model: model.to_string(),
messages,
temperature,
};
let response = self
.client
.post(self.chat_url())
.header("Authorization", format!("Bearer {}", api_key))
.header("Content-Type", "application/json")
.json(&request)
.send()
.await?;
if !response.status().is_success() {
let status = response.status();
let error = response.text().await?;
let sanitized = super::sanitize_api_error(&error);
anyhow::bail!("Telnyx API error ({}): {}", status, sanitized);
}
let chat_response: ChatResponse = response.json().await?;
chat_response
.choices
.into_iter()
.next()
.map(|c| c.message.content)
.ok_or_else(|| {
::zeroclaw_log::record!(
ERROR,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)
.with_outcome(::zeroclaw_log::EventOutcome::Failure),
"telnyx: empty choices in response"
);
anyhow::Error::msg("No response from Telnyx")
})View on GitHub (pinned to 88bb9c8533)
Solutions
- Read the status in the message: 401 → fix the API key; 400 → fix model name/parameters.
- 429 → back off and retry with exponential delay, or lower request rate.
- Confirm the model id in the provider entry is one Telnyx's models endpoint actually lists.
- 5xx → check Telnyx status page and retry later.
Example fix
# before — model id not offered by Telnyx [providers.models.telnyx.main] model = "gpt-4o" # after — an id that appears in the Telnyx models list [providers.models.telnyx.main] model = "meta-llama/Llama-3.1-70b-instruct"
Defensive patterns
Strategy: retry
Try / catch
Parse the status from the message: retry 429 and 5xx with exponential backoff + jitter (cap ~3 retries); fail immediately on 400/401 — they are deterministic config errors. Log the sanitized body verbatim for diagnosis.
Prevention
- Keep the Telnyx key in a secret manager with rotation, not stale env files
- Use model ids straight from the models listing
- Stay under Telnyx rate limits with client-side throttling
When it happens
Trigger: 401 from a bad key; 400 from an unsupported model name or invalid parameters for a single system-prompt turn; 429 rate limiting; 5xx provider errors.
Common situations: Key rotated but config still holds the old one; model id not enabled for the account; bursty traffic hitting Telnyx quotas; Telnyx incident.
Related errors
- Failed to list Telnyx models: {}
- Ollama API error ({}): {}. Is Ollama running? (brew install
- channel does not support room creation
- elicitation returned unknown choice const: {s}
- purge_namespace not supported by this memory backend
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/5d81abab0276f379.
Report an issue: GitHub.