{"record":{"id":"1a668a3a31216373","repo":"zeroclaw-labs/zeroclaw","slug":"flux-failed-status-body-text","errorCode":null,"errorMessage":"Flux failed ({status}): {body_text}","messagePattern":"Flux failed \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-tools/src/linkedin_client.rs","lineNumber":1146,"sourceCode":"        let body = json!({\n            \"prompt\": prompt,\n            \"image_size\": \"square_hd\",\n            \"num_images\": 1\n        });\n\n        let resp = client\n            .post(&url)\n            .header(\"Authorization\", format!(\"Key {api_key}\"))\n            .header(\"Content-Type\", \"application/json\")\n            .json(&body)\n            .send()\n            .await\n            .context(\"Flux request failed\")?;\n\n        let status = resp.status();\n        if !status.is_success() {\n            let body_text = resp.text().await.unwrap_or_default();\n            anyhow::bail!(\"Flux failed ({status}): {body_text}\");\n        }\n\n        let json: serde_json::Value = resp.json().await?;\n        let image_url = json\n            .pointer(\"/images/0/url\")\n            .and_then(|v| v.as_str())\n            .ok_or_else(|| {\n                ::zeroclaw_log::record!(\n                    ERROR,\n                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                        .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                        .with_attrs(::serde_json::json!({\"image_provider\": \"flux\"})),\n                    \"linkedin_client: Flux response missing image URL\"\n                );\n                anyhow::Error::msg(\"No image URL in Flux response\")\n            })?;\n\n        // Download the image from the returned URL","sourceCodeStart":1128,"sourceCodeEnd":1164,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-tools/src/linkedin_client.rs#L1128-L1164","documentation":"try_flux sends the prompt to the configured Flux REST endpoint and bails on any non-2xx status with the body embedded. The Flux key was already read from .env, so this error is the provider's HTTP-level response: auth, subscription/credits, queue pressure, or upstream failure.","triggerScenarios":"401/402 with an invalid key or exhausted subscription; 429 when the generation queue is saturated; 5xx from upstream model failures; malformed generation parameters rejected as 400.","commonSituations":"Flux API keys with expired subscriptions; burst posting hitting queue limits; regional endpoints unreachable from the deployment network.","solutions":["Read the embedded body_text to classify: auth vs billing vs queue vs upstream","Update the key in the env var named by the flux api_key_env config on 401/402","Back off and retry later on 429 — queue pressure is transient","Keep another provider earlier in the providers list so generate() falls through instead of failing the post"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"Per-provider failure consumed by generate(); on terminal failure, read the WARN log for the Flux status/body and either fix the subscription/key or wait out queue pressure (429).","preventionTips":["Keep the Flux subscription active — 402 surfaces here","Stagger scheduled generation to avoid queue saturation (429)","Order a more reliable provider first in the providers list"],"tags":["flux","image-generation","http","api-key"],"backgroundTag":"image-generation-api-error","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}