invoke-ai/InvokeAI · error · HTTPException
Failed to get image names
Error message
Failed to get image names
What it means
HTTP 500 raised by the image-names search endpoint when the underlying search/list call throws. The endpoint passes search_term, user_id and is_admin into the service and wraps any exception in this generic detail.
Source
Thrown at invokeai/app/api/routers/images.py:887
# Validate that the caller can read from this board before listing its images.
if board_id is not None and board_id != "none":
_assert_board_read_access(board_id, current_user)
try:
result = ApiDependencies.invoker.services.images.get_image_names(
starred_first=starred_first,
order_dir=order_dir,
image_origin=image_origin,
categories=categories,
is_intermediate=is_intermediate,
board_id=board_id,
search_term=search_term,
user_id=current_user.user_id,
is_admin=current_user.is_admin,
)
return result
except Exception:
raise HTTPException(status_code=500, detail="Failed to get image names")
@images_router.post(
"/images_by_names",
operation_id="get_images_by_names",
responses={200: {"model": list[ImageDTO]}},
)
def get_images_by_names(
current_user: CurrentUserOrDefault,
image_names: list[ImageName] = Body(
embed=True,
description="Object containing list of image names to fetch DTOs for",
max_length=MAX_IMAGE_BATCH_SIZE,
),
) -> list[ImageDTO]:
"""Gets image DTOs for the specified image names. Maintains order of input names."""
try:View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check server logs for the original traceback
- Retry with a simpler/empty search_term to isolate the term
- Verify database availability and integrity
- Restart InvokeAI if services are in a bad state
Defensive patterns
Strategy: retry
Validate before calling
// sanitize the search term before calling const term = (searchTerm ?? '').trim().slice(0, 200);
Try / catch
try {
const names = await api.getImageNames({ search_term: term });
} catch (e) {
if (e instanceof ApiError && e.status === 500) {
// retry once with empty search_term; alert if it still fails
}
} Prevention
- Trim/sanitize search terms client-side
- Fall back to unfiltered listing when search fails
- Monitor DB health; restart on lock errors
- Keep client params aligned with the server API version
When it happens
Trigger: GET /api/v1/images/names (with categories/search_term params) when the images service search fails — DB error, malformed search term handled improperly, or service unavailable.
Common situations: Special characters in search_term hitting an unescaped query path; sqlite locked or corrupted; API version mismatch where the client sends params the server service no longer accepts.
Related errors
- Failed to remove image from board
- Failed to add images to board
- Failed to remove images from board
- Failed to create board
- Failed to update board
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/67082cfd73bd9992.
Report an issue: GitHub.