Gemini API: 'Total file count exceeding 10000' error fires with 0 files listed and no video attached

Greetings, I am receiving the following error: “Total file count exceeding limit of 10000” fires incorrectly, even with 0 files and no video attached.

**Error:** `Total file count is X, exceeding limit of 10000` (seen at 10151, 14189, 20302) when calling `generate_content` with a YouTube URL via `file_data`/`file_uri` – not raw upload.

**Why, in my opinion, this looks like a bug, not a real quota:**

1. `files.list()` on the same project returns **0 files** at the exact time the error claims 10,000+.

2. The same error also fires on a **plain text-only prompt with no video/file attached at all**.

3. YouTube’s own native “Ask Gemini” feature summarizes the same hour-plus videos with no issue – suggesting this isn’t a real ingestion/frame-count limit, just specific to this API path.

**Environment:** `gemini-3.5-flash`, `google-genai` Python SDK, Prepay billing active, occurs both via direct API calls and in AI Studio’s UI on the same project.

The impact is that video summarization via YouTube URL becomes unreliable, with no way to predict, detect, or avoid it; it doesn’t correlate with video length, request volume, or anything visible via the public API.

I would be happy to share the project ID, timestamps, and request details if they are useful.

Thanks and Regards,

Tom Gannaway