[Gemini Video Understanding] Wrong video returned [Rick Roll] for valid YouTube IDs

I’ve been using the Gemini API to analyze videos using a custom prompt. For the most part it works fine, but I’ve run into an odd and frustrating issue: certain video IDs consistently default to the Rick Astley music video, even though the IDs I’m passing are valid and publicly viewable.

For example, when I try to process the video 30o4omX5qfo, the API returns results as if it’s analyzing the Rick Astley video instead of the intended video.

Is this expected behavior (perhaps a safety fallback)? If so, what’s the right way to handle it? The video I’m working with is educational, not harmful, and I even tried setting all harm categories to block_none, but it didn’t make a difference.

Any guidance on how I can navigate this would be much appreciated!

@nikhilkuppa

This could be related to the to a fall back like you mentioned, and this might beb because of the token count for the video, can you please check the total input token count of this ?

also regarding the rick roll video, can you tell us if you have analyzed that specific video before the above mentioned tag ?

Thanks for your response! The intended video’s token count is 106951, and no I never analyzed the rick roll video, the tagged video just happened to default to the rick roll video upon any analysis using my custom prompt, which however wasn’t the case for other simpler prompts where they worked as expected (no rick roll).

I however managed to fix this issue by adding additional JSON fields at the beginning of the schema prompting the model to return the title of the video, and a short summary of the video. I’m unsure why this was the fix as other videos with higher token count managed to return what I wanted without having to add these additional fields.