invoke-ai/InvokeAI · error · HTTPException
Failed to get intermediates
Error message
Failed to get intermediates
What it means
HTTP 500 raised by the GET intermediates-count endpoint when any exception escapes the call to ApiDependencies.invoker.services.images.get_intermediates_count(). The router wraps the service call in a broad try/except and converts every failure into a generic 'Failed to get intermediates' message, hiding the underlying cause.
Source
Thrown at invokeai/app/api/routers/images.py:283
try:
count_deleted = ApiDependencies.invoker.services.images.delete_intermediates()
return count_deleted
except Exception:
raise HTTPException(status_code=500, detail="Failed to clear intermediates")
@images_router.get("/intermediates", operation_id="get_intermediates_count")
def get_intermediates_count(
current_user: CurrentUserOrDefault,
) -> int:
"""Gets the count of intermediate images. Non-admin users only see their own intermediates."""
try:
user_id = None if current_user.is_admin else current_user.user_id
return ApiDependencies.invoker.services.images.get_intermediates_count(user_id=user_id)
except Exception:
raise HTTPException(status_code=500, detail="Failed to get intermediates")
@images_router.patch(
"/i/{image_name}",
operation_id="update_image",
response_model=ImageDTO,
)
def update_image(
current_user: CurrentUserOrDefault,
image_name: str = Path(description="The name of the image to update"),
image_changes: ImageRecordChanges = Body(description="The changes to apply to the image"),
) -> ImageDTO:
"""Updates an image"""
_assert_image_owner(image_name, current_user)
assert_image_move_maintenance_inactive()
try:
return ApiDependencies.invoker.services.images.update(image_name, image_changes)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check server logs for the original exception logged before the 500 is returned
- Verify the images database/sqlite file exists and is writable
- Restart InvokeAI so services are re-initialized
- If persistent, report with the traceback since the API response hides the cause
Defensive patterns
Strategy: try-catch
Validate before calling
// client side: ensure API is reachable before calling
const health = await fetch('/api/v1/app-version');
if (!health.ok) throw new Error('API not ready'); Try / catch
try {
const count = await api.getIntermediatesCount();
} catch (e) {
if (e instanceof ApiError && e.status === 500) {
// service-level failure; surface server log pointer, offer retry
}
} Prevention
- Keep the sqlite DB file present, writable, and backed up
- Restart the app after any service init errors before hitting the API
- Watch server logs — the 500 detail hides the real cause
- Avoid manual deletion of DB files while InvokeAI is running
When it happens
Trigger: GET /api/v1/images/intermediates/count when the images service is unavailable, the underlying image records store raises (e.g. database locked/corrupt), or user_id filtering fails because session state is stale.
Common situations: Database file deleted or locked while InvokeAI runs; services not fully initialized after a failed startup; multi-user setups where the user record referenced by current_user no longer exists.
Related errors
- Failed to remove image from board
- Failed to delete images
- Failed to star images
- Failed to unstar images
- Failed to get image DTOs
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/4427eca284e3b2b6.
Report an issue: GitHub.