zeroclaw-labs/zeroclaw · error · anyhow::Error
DALL-E failed ({status}): {body_text}
Error message
DALL-E failed ({status}): {body_text} What it means
try_dalle posts to OpenAI's image generation endpoint and bails on any non-2xx status with the body embedded. The OpenAI key was already found in .env, so this error reflects the API response: invalid credentials, billing/quota limits, parameter rejection, or content policy.
Source
Thrown at crates/zeroclaw-tools/src/linkedin_client.rs:1090
"prompt": prompt,
"n": 1,
"size": self.config.dalle.size,
"response_format": "b64_json"
});
let resp = client
.post(url)
.header("Authorization", format!("Bearer {api_key}"))
.header("Content-Type", "application/json")
.json(&body)
.send()
.await
.context("DALL-E request failed")?;
let status = resp.status();
if !status.is_success() {
let body_text = resp.text().await.unwrap_or_default();
anyhow::bail!("DALL-E failed ({status}): {body_text}");
}
let json: serde_json::Value = resp.json().await?;
let b64 = json
.pointer("/data/0/b64_json")
.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": "dalle"})),
"linkedin_client: DALL-E response missing image data"
);
anyhow::Error::msg("No image data in DALL-E response")
})?;
let bytes = base64_decode(b64)?;View on GitHub (pinned to 88bb9c8533)
Solutions
- Read the embedded body_text; OpenAI's message distinguishes auth, billing, invalid_request_error, and content policy
- Update the key in the env var named by the dalle api_key_env config if 401
- Check org billing and rate limits on 429, then back off
- Fix the size/model parameters per the current OpenAI images API, and configure a second provider for fallthrough
Defensive patterns
Strategy: fallback
Try / catch
Per-provider failure consumed by generate(); on terminal failure, read the WARN log entry carrying the DALL-E status/body: 401 means fix the key, 429 means billing/quota, content_policy means rephrase.
Prevention
- Keep OpenAI billing active and quota headroom for image bursts
- Use size/quality values valid for the configured model generation
- Keep another provider configured for fallthrough
When it happens
Trigger: 401 for an invalid or revoked OPENAI_API_KEY; 429 when the org hits rate limits or has no billing; 400 for an invalid size/quality/model combination or malformed prompt; 400 with content_policy_violation for disallowed prompts.
Common situations: Key rotated in the OpenAI dashboard but not in workspace .env; trial credits exhausted; requesting dall-e-2 sizes on a dall-e-3 config (or vice versa); prompts that mention public figures.
Related errors
- Embedding API error {status}: {text}
- Stability AI failed ({status}): {body_text}
- Imagen failed ({status}): {body_text}
- Flux failed ({status}): {body_text}
- OpenAI TTS API error ({}): {}
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/800d0011dadc30ea.
Report an issue: GitHub.