invoke-ai/InvokeAI · error · HTTPException
Failed to get image DTOs
Error message
Failed to get image DTOs
What it means
HTTP 500 raised by POST /images/images_by_names when resolving image names to DTOs throws outside the per-image skip logic. The endpoint intentionally skips individual missing images (deleted between fetch steps), so this error means a broader failure occurred — not a single missing image.
Source
Thrown at invokeai/app/api/routers/images.py:924
image_service = ApiDependencies.invoker.services.images
# Fetch DTOs preserving the order of requested names
image_dtos: list[ImageDTO] = []
for name in image_names:
try:
_assert_image_read_access(name, current_user)
dto = image_service.get_dto(name)
image_dtos.append(dto)
except HTTPException:
# Skip images the user is not authorized to view
continue
except Exception:
# Skip missing images - they may have been deleted between name fetch and DTO fetch
continue
return image_dtos
except Exception:
raise HTTPException(status_code=500, detail="Failed to get image DTOs")
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check server logs for the underlying exception
- Split the name list into smaller batches
- Remove suspect image names (recently deleted) and retry
- Verify DB integrity; repair or restart if corrupted
Defensive patterns
Strategy: try-catch
Validate before calling
// chunk the name list before the batch lookup const chunks = []; for (let i = 0; i < imageNames.length; i += 50) chunks.push(imageNames.slice(i, i + 50));
Try / catch
try {
const dtos = await api.getImagesByNames(names);
} catch (e) {
if (e instanceof ApiError && e.status === 500) {
// retry per-chunk; drop names that fail to resolve
}
} Prevention
- Chunk large name lists into small batches
- Treat individual missing images as normal (server skips them)
- Refresh name lists shortly before DTO lookups
- Check DB integrity if failures repeat on the same names
When it happens
Trigger: POST /api/v1/images/images_by_names when the batch DTO lookup service raises (DB failure) or the outer iteration itself errors, e.g. image_dtos.append path failing on a malformed record.
Common situations: Very large image_names list causing query limits/timeouts; a record corrupted such that even the per-image try/except throws outside it; DB lock contention.
Related errors
- Failed to remove image from board
- Failed to get intermediates
- Failed to delete images
- Failed to star images
- Failed to unstar images
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/2c007f251b7e7384.
Report an issue: GitHub.