zeroclaw-labs/zeroclaw · error · anyhow::Error
Stability AI failed ({status}): {body_text}
Error message
Stability AI failed ({status}): {body_text} What it means
try_stability sends the prompt to the Stability AI REST API and bails on any non-2xx status, embedding the status and response body. It runs only after read_env_var found the configured Stability key, so a failure here is about the request or response, not key configuration.
Source
Thrown at crates/zeroclaw-tools/src/linkedin_client.rs:969
"width": 1024,
"samples": 1,
"steps": 30
});
let resp = client
.post(&url)
.header("Authorization", format!("Bearer {api_key}"))
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.json(&body)
.send()
.await
.context("Stability AI request failed")?;
let status = resp.status();
if !status.is_success() {
let body_text = resp.text().await.unwrap_or_default();
anyhow::bail!("Stability AI failed ({status}): {body_text}");
}
let json: serde_json::Value = resp.json().await?;
let b64 = json
.pointer("/artifacts/0/base64")
.and_then(|v| v.as_str())
.ok_or_else(|| {
::zeroclaw_log::record!(
ERROR,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)
.with_outcome(::zeroclaw_log::EventOutcome::Failure)
.with_attrs(::serde_json::json!({"image_provider": "stability"})),
"linkedin_client: Stability response missing image data"
);
anyhow::Error::msg("No image data in Stability response")
})?;
let bytes = base64_decode(b64)?;View on GitHub (pinned to 88bb9c8533)
Solutions
- Read body_text — Stability returns a message naming the invalid parameter or the auth problem
- Update the Stability key in .env if the status is 401/403
- Check billing and credits on 402, and back off on 429
- Keep a second provider (dalle, imagen, flux) in the providers list so generate() can fall through automatically
Defensive patterns
Strategy: fallback
Try / catch
You rarely catch this directly: generate() already swallows per-provider failures and moves on. Catch generate()'s terminal error instead and act on the earlier WARN logs that carry the Stability status and body.
Prevention
- Configure a second provider after stability in the providers list
- Monitor Stability credit balance before scheduled runs
- Keep the key in the env var named by stability.api_key_env current
When it happens
Trigger: 401/403 with an invalid or revoked Stability key; 400 for an unsupported engine id, aspect ratio, or output parameter; 402/429 when credits are exhausted or the org is throttled; connection failures through restricted egress proxies.
Common situations: Rotated keys not updated in the workspace .env; free-tier credits exhausted mid-campaign; changing the engine id to one the account cannot access.
Related errors
- Imagen failed ({status}): {body_text}
- DALL-E failed ({status}): {body_text}
- Flux failed ({status}): {body_text}
- Embedding API error {status}: {text}
- Composio v3 API error: {err}
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/1989a90822d02b63.
Report an issue: GitHub.