zeroclaw-labs/zeroclaw · error
All image generation model_providers failed and fallback_car
Error message
All image generation model_providers failed and fallback_card is disabled
What it means
ImageGenerator::generate walks the configured providers list (stability, imagen, dalle, flux) in order; every provider either failed (missing key in .env, HTTP error, exhausted credits) or was skipped as an unknown name. With fallback_card disabled there is no branded-SVG fallback, so the whole operation bails. Each per-provider cause was already logged as a WARN 'Image model_provider failed' event with the provider name and error.
Source
Thrown at crates/zeroclaw-tools/src/linkedin_client.rs:893
::zeroclaw_log::record!(WARN, ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note).with_outcome(::zeroclaw_log::EventOutcome::Unknown).with_attrs(::serde_json::json!({"error": format!("{}", e), "provider_name": provider_name})), "Image model_provider '' failed");
}
}
}
// All AI model_providers failed — try SVG fallback
if self.config.fallback_card {
let svg_path = image_dir.join(format!("{base_name}.svg"));
let svg_content = Self::generate_fallback_card(prompt, &self.config.card_accent_color);
tokio::fs::write(&svg_path, &svg_content).await?;
::zeroclaw_log::record!(
INFO,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
&format!("Fallback SVG card generated: {}", svg_path.display())
);
return Ok(svg_path);
}
anyhow::bail!("All image generation model_providers failed and fallback_card is disabled")
}
/// Read an env var value from the workspace .env file (same format as LinkedInClient).
async fn read_env_var(workspace_dir: &Path, var_name: &str) -> anyhow::Result<String> {
let env_path = workspace_dir.join(".env");
let content = tokio::fs::read_to_string(&env_path)
.await
.with_context(|| format!("Failed to read {}", env_path.display()))?;
for line in content.lines() {
let line = line.trim();
if line.starts_with('#') || line.is_empty() {
continue;
}
let line = line.strip_prefix("export ").map(str::trim).unwrap_or(line);
if let Some((key, value)) = line.split_once('=')
&& key.trim() == var_name
{View on GitHub (pinned to 88bb9c8533)
Solutions
- Check the preceding WARN logs — each provider failure records its error and provider_name, distinguishing missing-key from API failure
- Set at least one provider key in the workspace .env, matching the env var name configured in that provider's api_key_env
- Enable fallback_card in the LinkedIn image config so a branded SVG card is produced instead of an error
- Verify provider names are exactly stability, imagen, dalle, or flux
Example fix
# before (config) fallback_card = false providers = ["dalle"] # .env has no OPENAI_API_KEY # after fallback_card = true providers = ["dalle", "stability"] # .env OPENAI_API_KEY=sk-...
Defensive patterns
Strategy: fallback
Validate before calling
fn any_provider_key(dir: &Path, cfg: &LinkedInImageConfig) -> bool {
let names: Vec<&str> = vec![
&cfg.stability.api_key_env, &cfg.imagen.api_key_env,
/* dalle + flux api_key_env */
];
names.iter().any(|k| env_has_key(dir, k))
}
anyhow::ensure!(
any_provider_key(&workspace_dir, &image_config) || image_config.fallback_card,
"image generation will always fail: no provider key and fallback_card disabled"
); Try / catch
Catch the generate() error and degrade gracefully: post text-only, or produce your own placeholder asset — the library has no further fallback once fallback_card is off.
Prevention
- Keep at least two providers in the providers list so one bad key does not sink the post
- Enable fallback_card for unattended scheduled posting
- Alert on the WARN 'Image model_provider failed' logs before the hard failure appears
When it happens
Trigger: No *_API_KEY entries in the workspace .env for any configured provider; keys present but every request failed (401/403 expired key, 429 quota, blocked egress); providers list empty or containing only misspelled names, which are skipped with a WARN and never tried.
Common situations: New workspaces whose .env was never filled in; expired billing on the single configured provider; names like 'dalle3' instead of 'dalle' in the image providers config.
Related errors
- providers.models.{profile_name}.uri must use http/https
- providers.models.{profile_name}.pricing.{key}: value must no
- providers.models.{profile_name}.pricing.{key}: value must be
- providers.models.ollama.{alias}.model uses ':cloud', but uri
- providers.models.ollama.{alias}.model uses ':cloud', but no
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/34e3b58ca5d60a54.
Report an issue: GitHub.