huggingface/transformers · error · TypeError
only a single or a list of entries is supported but got type
Error message
only a single or a list of entries is supported but got type={type(image_url_or_urls)} What it means
Error "only a single or a list of entries is supported but got type={type(image_url_or_urls)}" thrown in huggingface/transformers.
Source
Thrown at src/transformers/image_processing_base.py:487
raise ValueError(f"{auto_class} is not a valid auto class.")
cls._auto_class = auto_class
def fetch_images(self, image_url_or_urls: str | list[str] | list[list[str]]):
"""
Convert a single or a list of urls into the corresponding `PIL.Image` objects.
If a single url is passed, the return value will be a single object. If a list is passed a list of objects is
returned.
"""
if isinstance(image_url_or_urls, (list, tuple)):
return [self.fetch_images(x) for x in image_url_or_urls]
elif isinstance(image_url_or_urls, str):
return load_image(image_url_or_urls)
elif is_valid_image(image_url_or_urls):
return image_url_or_urls
else:
raise TypeError(f"only a single or a list of entries is supported but got type={type(image_url_or_urls)}")
ImageProcessingMixin.push_to_hub = copy_func(ImageProcessingMixin.push_to_hub)
if ImageProcessingMixin.push_to_hub.__doc__ is not None:
ImageProcessingMixin.push_to_hub.__doc__ = ImageProcessingMixin.push_to_hub.__doc__.format(
object="image processor", object_class="AutoImageProcessor", object_files="image processor file"
)
View on GitHub (pinned to a597f97485)
Solutions
- Pass a single image URL/path or a list of them.
- Convert other iterables to a list before calling.
When it happens
Trigger: Raised in ImageProcessingMixin image loading when image_url_or_urls is neither a single entry nor a list.
Common situations: Passing a dict, tuple-of-tuples, or generator of image URLs/paths to the image loading helper.
AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14).
Data as JSON: /api/errors/5ded550332553ba8.
Report an issue: GitHub.