ATH-MaaS/Pixelle-Video · error · HTTPException
str(e)
Error message
str(e)
What it means
The /image/generate endpoint wraps image generation in a broad except Exception and re-raises any unexpected failure as HTTP 500 with str(e) as the detail. HTTPExceptions (like the video-workflow 400 above) are re-raised unchanged. This 500 means the generation pipeline itself failed — workflow lookup, execution, or result handling — with the internal error text exposed to the client.
Source
Thrown at api/routers/image.py:69
workflow=request.workflow
)
# For backward compatibility, only support image results in /image endpoint
if media_result.is_video:
raise HTTPException(
status_code=400,
detail="Video workflow used. Please use /media/generate endpoint for video generation."
)
return ImageGenerateResponse(
image_path=media_result.url
)
except HTTPException:
raise
except Exception as e:
logger.error(f"Image generation error: {e}")
raise HTTPException(status_code=500, detail=str(e))
View on GitHub (pinned to 848b054e4f)
Solutions
- Check server logs for 'Image generation error:' to identify the root cause
- Verify the generation backend (e.g. ComfyUI) is running and reachable
- Confirm the requested workflow exists and is an image workflow
- Retry the request if the failure was a transient timeout
- Server-side: return a generic detail instead of str(e) and log the stack trace
Example fix
// before
except Exception as e:
logger.error(f"Image generation error: {e}")
raise HTTPException(status_code=500, detail=str(e))
// after
except Exception:
logger.exception("Image generation error")
raise HTTPException(status_code=500, detail="Image generation failed; see server logs") Defensive patterns
Strategy: try-catch
Validate before calling
// verify backend health and workflow validity before generating
const health = await fetch(`${base}/health`).then(r => r.ok);
const workflows = (await fetch(`${base}/workflows/image`).then(r => r.json())).workflows;
if (!health || !workflows.some(w => w.id === request.workflow)) throw new Error('Backend down or unknown workflow'); Type guard
function isImageResult(m) { return m != null && typeof m === 'object' && m.is_video === false && typeof m.url === 'string'; } Try / catch
try {
const res = await fetch('/image/generate', {method:'POST', body: JSON.stringify(req)});
if (!res.ok) throw Object.assign(new Error((await res.json().catch(()=>({}))).detail ?? 'generation failed'), {status: res.status});
return await res.json();
} catch (err) {
if (err.status >= 500 && attempts < 3) return retryWithBackoff();
throw err;
} Prevention
- Check the media backend health endpoint before batch generation
- Validate workflow names against GET /workflows/image
- Use exponential backoff for 500s that stem from transient backend timeouts
- Report the server-side 'Image generation error' log line when filing bugs
When it happens
Trigger: POST /image/generate where the underlying media service call throws: ComfyUI/workflow engine unreachable, workflow JSON invalid, model missing, timeout, or unexpected response shape from media generation.
Common situations: Backend ComfyUI service down or restarting; workflow file removed or renamed after a version upgrade; GPU OOM during inference; network timeout between API and generation backend.
Related errors
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/e7c455132d73299e.
Report an issue: GitHub.