“Token count failed” is the message Google AI Studio shows when it cannot count the tokens of something you added to a prompt. We looked for an official Google page that explains it and found none on November 29, 2026, so we cannot give you one cause. The public forum threads point to several: a model with a small input limit, a file near a size limit, a very long chat, video uploads, and a fault on Google’s side that was fixed on October 30, 2026.
We did not reproduce the error ourselves. Everything below comes from forum threads and Google’s own pages, and each one is linked.
A routine to narrow it down
This is our suggestion. It is not an official Google fix.
- Check the model. In a November 2025 thread a forum staff account traced a rejected attachment to the default model of new sessions, which had an input limit of 32,768 tokens. The prompt had 50,568. Choosing another model in the model selector fixed it. The message there read “Token count for the prompt has been exceeded”, which is not the same text as “Token count failed”, but it is the one cause in the forum that a staff reply confirms.
- Wait and look at the newest threads. On October 30, 2026 uploads failed for several people, and Google-labeled accounts wrote that a fix had been pushed and later that it was fixed. If a file that worked yesterday fails today, check the forum before you change anything.
- Try a tiny file of the same type. If a one-page PDF or a five-second clip is counted and your real file is not, the cause is probably size or content. If even the tiny one fails, suspect the service, your project or your account. The August 2026 thread points at the project and its billing, without confirming it.
- Do the multiplication. The numbers for pages, seconds and image tiles are in the section on Google’s limits below.
- Count the text on your own device. For a PDF, Word or text file, the token counter on this site shows the tokens of the text and runs in your browser, so nothing is uploaded. Its Gemini figure is an estimate (characters divided by 4), which suits English prose and is weak for other languages, as our post on what a token is shows.
- Split the file. The users in the 2024 thread split their files and uploaded the parts one by one, and one said the answers were worse than with the whole file. Our guide for long PDF and Word files shows how to split a text into numbered parts.
- Paste the text instead of attaching the file. This is not a documented fix. It skips the attachment step, and you lose pictures and layout. We do not know whether it avoids the error.
- For video, shorten the clip. Google’s table lists a lower default resolution and a higher one with about three times the tokens per second, so a shorter clip counts fewer tokens at either setting.
- For a long chat, try the users’ workarounds. In a 38-post thread from October 2025, chats of about 300,000 to 400,000 tokens stopped counting. Users suggested scrolling to the start of the chat and back to the bottom, or sending with Alt+Enter and running the prompt by hand. Google did not confirm either, and one user warned that the model then knows only the part of the chat that was counted. We did not test them.
- Report it with details. Post the model, the file type and size, the time and the exact text of the message. In the August 2026 thread a moderator asked for the project ID and the account email by private message. Send such details only in the forum’s own messages and only to an account that the forum marks as staff or moderator.
What users reported
These are threads on the Google AI Developers Forum, as we read them on November 29, 2026.
| Thread | What was added | What happened |
|---|---|---|
| Failed to count tokens for this attachment, July 2024 to August 2026 | PDFs, a long text file, a CSV, an 8-hour MP3 | PDFs above roughly 100,000 to 200,000 tokens failed and smaller ones worked. In August 2024 Logan_Kilpatrick, an account labeled Google, wrote that there was a limit of 300 pages for PDFs. Users split their files. A user wrote on August 3, 2026 that the problem had come back. |
| Attaching files greater than a few thousand k fails, November 2025 | Files in a new session | A staff account found that the default model had a limit of 32,768 tokens and the prompt had 50,568. Choosing another model fixed it. |
| Failed to count tokens, October to November 2025 | Long chats | Chats of about 300,000 to 400,000 tokens stopped counting and users could not continue. No reply from Google. |
| Token count failed error, February 2026 | A 3.7 MB PDF | It worked on two model settings and then failed on all of them. Clearing the cache, another browser and a new chat did not help. No reply. Closed automatically on November 5, 2026. |
| MP4 upload issue, July 2026 | One MP4 video | The error came with an HTTP status 500. No reply. Closed automatically on November 5, 2026. |
| Every video upload fails, August 2026 | Videos, including iPhone clips and files re-encoded as H.264 | Every video failed in Gemini 3.1 Pro Preview, on several accounts and in a private window, while images worked. The moderator Mahesh_Sutar asked for the project ID and later wrote that the project was on the free tier, which has some access restrictions, and asked whether billing was linked. No fix is given. |
| Failed to count tokens, please try again, November 2025 | A 34-minute .wav file | A different wording of the same kind of failure. A reply asked which model and what exactly happened. No fix is shown. |
| Token count failed error when uploading images, October 30, 2026 | Images | Every image upload failed, with and without an API key. Jon_Matthews, an account labeled Google, wrote that it could be related to an issue for which a fix had just been pushed. Nobody confirmed afterwards. |
| Paid API key fails only in AI Studio, October 30, 2026 | A paid API key | The poster saw “An internal error has occurred” and a network log with 403 answers to the browser’s preflight requests for CountTokens and GenerateContent. A later poster reported “count token failed” on an attachment. Jon_Matthews wrote that it was raised as a top priority and later that it was fixed. Nothing for the user to do. |
What this shows is limited. Two threads end with a cause or a fix from a Google-labeled or staff account: the model limit of November 2025 and the fault of October 30, 2026. The rest are open questions, some closed by the forum without an answer. Guesses such as Google Drive storage or free tier restrictions appear in them, and Google confirms none. A different message, “too many input tokens”, has its own thread about long chats on the free tier, without a cause.
What Google publishes about size
Google’s pages describe the Gemini API. They do not say that AI Studio applies the same limits to every upload, so treat them as the nearest reference.
On the document processing page (checked on November 29, 2026):
- A PDF may have up to 1,000 pages and be up to 50 MB. An Office or OpenDocument file may have up to 2,000 pages or slides. The limits apply to inline data and to uploads through the Files API.
- Each PDF page costs about 280, 560 or 1,120 tokens at the low, medium (the default) and high resolution on Gemini 4 and Gemini 3 models, and a flat 258 tokens on Gemini 2.5 models.
- Text inside the PDF is extracted at no extra token charge.
On the tokens page (checked on November 29, 2026):
- A token is about 4 characters, and 100 tokens are about 60 to 80 English words.
- An image of 384 pixels or less on both sides counts 258 tokens. Larger images are cut into tiles of 768 by 768 pixels, at 258 tokens each.
- Audio counts 32 tokens per second.
- Video counts 263 tokens per second in one bullet, and the video table on the same page gives about 100 tokens per second at the default resolution and about 300 at high resolution. The page disagrees with itself here, so we use all three.
- The Gemini 4 models share a window of 1,048,576 tokens.
With those numbers you can check a file before you upload it:
- A 1,000-page PDF is within the page limit. At the default 560 tokens a page it is 560,000 tokens, which fits the window. At 1,120 tokens a page it is 1,120,000, which does not.
- One hour of video is 3,600 seconds. At 263 tokens a second that is 946,800 tokens. At 100 it is 360,000. At 300 it is 1,080,000, which is over the window.
- The 34-minute .wav file in the November 2025 thread is 2,040 seconds, or 65,280 tokens at 32 a second. That is far below the window, so size alone does not explain that failure.
What we cannot tell you
We cannot say what the message means in your case. Google has not explained it, the threads disagree, and the service changes: a limit of 300 pages quoted in 2024 sits next to a documented limit of 1,000 pages today. If you find a cause that Google confirms, tell us on the Contact page and we will update this post.
Sources
All pages were read on November 29, 2026.
- Google AI Developers Forum: the nine threads linked in the table above, and Too many input tokens error.
- Gemini API, document processing: page and size limits, tokens per page. The old address ai.google.dev/gemini-api/docs/document-processing leads here.
- Gemini API, understand and count tokens: tokens per character, image, audio and video, and the window of Gemini 4. The old address ai.google.dev/gemini-api/docs/tokens leads here.
Featured photo: Mikhail Nilov on Pexels.



