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

  1. Check server logs for the original traceback
  2. Retry with a simpler/empty search_term to isolate the term
  3. Verify database availability and integrity
  4. 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

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


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/67082cfd73bd9992. Report an issue: GitHub.