{"record":{"id":"1bdaa609a9eb2f26","repo":"roboflow/supervision","slug":"could-not-create-image-tiles-from-empty-list-of-im","errorCode":null,"errorMessage":"Could not create image tiles from empty list of images.","messagePattern":"Could not create image tiles from empty list of images\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/supervision/utils/image.py","lineNumber":840,"sourceCode":"        titles_thickness: Thickness of title text.\n        titles_padding: Size of title padding.\n        titles_text_font: Font used to render titles. Must be an integer\n            constant representing an OpenCV font.\n            (See docs: https://docs.opencv.org/4.x/d6/d6e/group__imgproc__draw.html)\n        titles_background_color: Color of the title text padding.\n        default_title_placement: Title anchor placement used when an explicit\n            anchor is not provided.\n\n    Returns:\n        ImageType: Image with all input images located in tiles grid. The output type is\n            determined by `return_type` parameter.\n\n    Raises:\n        ValueError: In case when input images list is empty, provided `grid_size` is too\n            small to fit all images, `tile_scaling` mode is invalid.\n    \"\"\"\n    if len(images) == 0:\n        raise ValueError(\"Could not create image tiles from empty list of images.\")\n    if return_type == \"auto\":\n        return_type = _negotiate_tiles_format(images=images)\n    tile_padding_color = unify_to_bgr(color=tile_padding_color)\n    tile_margin_color = unify_to_bgr(color=tile_margin_color)\n    images_cv2 = images_to_cv2(images=images)\n    if single_tile_size is None:\n        single_tile_size = _aggregate_images_shape(images=images_cv2, mode=tile_scaling)\n    resized_images = [\n        letterbox_image(\n            image=i, resolution_wh=single_tile_size, color=tile_padding_color\n        )\n        for i in images_cv2\n    ]\n    grid_size = _establish_grid_size(images=images_cv2, grid_size=grid_size)\n    if len(images_cv2) > grid_size[0] * grid_size[1]:\n        raise ValueError(\n            f\"Could not place {len(images_cv2)} in grid with size: {grid_size}.\"\n        )","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/roboflow/supervision/blob/7f254d9784d4c37e0f03cd89ddee164c8db099c0/src/supervision/utils/image.py#L822-L858","documentation":"Raised by `sv.create_tiles` when the `images` list is empty. Building a grid of tiles from zero images has no meaningful result (no width, height, or grid size can be negotiated), so the function rejects the input early with a clear message instead of failing inside numpy/OpenCV.","triggerScenarios":"Passing `[]` directly; passing the result of a filter/list comprehension that removed every element (e.g. all detections below threshold, so no crops were collected); an early-morning batch where the first folder is empty.","commonSituations":"Visualizing top-k detection crops when the model found nothing; aggregating frames from a queue that was drained; looping over directories where some contain zero images.","solutions":["Guard the call: `if crops: montage = sv.create_tiles(images=crops)`.","Check the upstream filter — if everything was filtered out, your threshold or mask may be wrong.","For batch jobs, skip empty groups and log them instead of calling create_tiles."],"exampleFix":"# before\nmontage = sv.create_tiles(images=[crop for crop in crops if crop.area > 0.1])  # may be []\n# after\ncrops = [crop for crop in crops if crop.area > 0.1]\nmontage = sv.create_tiles(images=crops) if crops else None","handlingStrategy":"validation","validationCode":"assert len(images) > 0, 'cannot build tiles from zero images'","typeGuard":"def has_images(images: list) -> bool:\n    return len(images) > 0","tryCatchPattern":null,"preventionTips":["Guard create_tiles with `if images:` at call sites.","Log when filters produce zero crops — often a threshold bug.","In batch loops over folders, skip empty groups explicitly."],"tags":["image","tiles","empty-input","validation"],"backgroundTag":null,"analyzedSha":"7f254d9784d4c37e0f03cd89ddee164c8db099c0","analyzedAt":"2026-08-15T05:13:01.950Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}