Skip to content

Fix IndexError when preprocessing an empty image or video list - #14840

Open
MohammadHijjawi97 wants to merge 1 commit into
huggingface:mainfrom
MohammadHijjawi97:fix/empty-image-list-preprocess
Open

MohammadHijjawi97 wants to merge 1 commit into
huggingface:mainfrom
MohammadHijjawi97:fix/empty-image-list-preprocess

Conversation

@MohammadHijjawi97

@MohammadHijjawi97 MohammadHijjawi97 commented Sep 22, 2026

Copy link
Copy Markdown

What does this PR do?

is_valid_image_imagelist([]) returns True because all([]) is True, so preprocess then crashes with IndexError on image[0] / video[0].

This rejects an empty list before that indexing path and raises a clear ValueError.

Fixes #14864

Tests

New tests fail on unmodified main (IndexError) and pass with the fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added tests size/S PR with diff < 50 LOC labels Sep 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @MohammadHijjawi97, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Fixes #1234) to the PR description so the issue is linked. See the contribution guide for more details. If this PR intentionally does not fix a tracked issue, a maintainer can add the no-issue-needed label to silence this reminder.

Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice.

Once the PR links an issue (or gets the no-issue-needed label), you can ignore this message — it stays here as a comment, but it no longer applies.

@MohammadHijjawi97

Copy link
Copy Markdown
Author

Opened #14864 for this and linked it with Fixes #14864 in the description.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndexError when preprocessing an empty image or video list

1 participant