zeroclaw-labs/zeroclaw · error · anyhow::Error
Failed to list Telnyx models: {}
Error message
Failed to list Telnyx models: {} What it means
The Telnyx provider's list_models issued its GET against the Telnyx AI models endpoint and got a non-success HTTP status; the raw response body is embedded in the error (this path does not run sanitize_api_error). Typical causes are authentication failures or a wrong base URL rather than transient network issues.
Source
Thrown at crates/zeroclaw-providers/src/telnyx.rs:84
ERROR,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
.with_outcome(::zeroclaw_log::EventOutcome::Failure)
.with_attrs(::serde_json::json!({"missing": "api_key"})),
"telnyx: API key not configured"
);
anyhow::Error::msg("Telnyx API key not set. Set TELNYX_API_KEY environment variable.")
})?;
let response = self
.client
.get(format!("{}/models", BASE_URL))
.header("Authorization", format!("Bearer {}", api_key))
.send()
.await?;
if !response.status().is_success() {
let error = response.text().await?;
anyhow::bail!("Failed to list Telnyx models: {}", error);
}
let models_response: ModelsResponse = response.json().await?;
Ok(models_response.data.into_iter().map(|m| m.id).collect())
}
/// Build the chat completions URL
fn chat_url(&self) -> String {
format!("{}/chat/completions", BASE_URL)
}
}
fn resolve_telnyx_api_key(api_key: Option<&str>) -> Option<String> {
api_key
.map(str::trim)
.filter(|k| !k.is_empty())
.map(ToString::to_string)
}View on GitHub (pinned to 88bb9c8533)
Solutions
- Curl the models endpoint with the same key and inspect the status and body to confirm the failure.
- Verify the API key is set, current, and has AI API scope in the Telnyx console.
- Check the telnyx provider's base_url matches Telnyx's AI inference endpoint.
- For 5xx bodies, retry later — nothing in the client config will fix a provider outage.
Example fix
# before — key from another product, no AI scope export TELNYX_API_KEY="KEYxxxxxxxx voice-only" # after — key created with AI API access in the Telnyx console export TELNYX_API_KEY="KEYxxxxxxxx-with-ai-scope"
Defensive patterns
Strategy: try-catch
Validate before calling
# Verify key + endpoint before the first programmatic call
curl -s -o /dev/null -w '%{http_code}' \
-H "Authorization: Bearer $TELNYX_API_KEY" \
"$TELNYX_BASE_URL/models" # expect 200 Try / catch
Catch the error, curl the same endpoint with the same key to confirm, then branch: 401/403 → fix credentials (do not retry), 5xx → retry later with backoff. The body in the message is the API's own error text — surface it.
Prevention
- Create the key with AI API scope in the Telnyx console, not a Voice/Messaging key
- Smoke-test the models endpoint in CI with the real secret
- Alert on repeated list_models failures to catch key expiry early
When it happens
Trigger: Invalid or expired Telnyx API key yields 401 with the API's error body; account without AI API access; base_url misconfigured so the models path lands on the wrong Telnyx product; Telnyx-side 5xx.
Common situations: TELNYX_API_KEY unset or stale in the environment; a key provisioned for Voice/Messaging only; copy-pasting another provider's base_url into the telnyx provider entry.
Related errors
- Telnyx API error ({}): {}
- 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/f3e9047916c407d1.
Report an issue: GitHub.