File Search importFile / uploadToFileSearchStore returns 503 "Failed to count tokens" for valid files

Hello,

I am experiencing a reproducible issue with Gemini API File Search.

The problem occurs when registering valid files into an existing File Search Store.

Environment:

  • Gemini API / File Search
  • Existing File Search Store
  • API key is valid and restricted to Gemini API
  • Files API upload succeeds and the uploaded file reaches ACTIVE state

Observed behavior:

  1. Upload the file to Google Files API
  2. The file becomes ACTIVE
  3. Call fileSearchStores.importFile
  4. After about 80 seconds, the request fails with:

HTTP 503 UNAVAILABLE

{
“error”: {
“code”: 503,
“message”: “Failed to count tokens.”,
“status”: “UNAVAILABLE”
}
}

No Operation name is returned.

I also tested the official uploadToFileSearchStore route.
It also fails with HTTP 503 after a long wait.

The affected file is:

  • text/plain
  • UTF-8
  • 113,962 bytes
  • no invalid UTF-8
  • no NULL bytes
  • no obvious control-character corruption

Additional checks:

  • countTokens succeeds for the same content
  • gemini-embedding-001 embedding succeeds for the same content
  • the same File Search Store has successfully accepted other DOCX files
  • another File Search Store has successfully accepted a text/plain file of about 1.93 MB
  • therefore this does not appear to be a simple file-size limitation
  • the official per-document File Search size limit is far above the affected file size

This issue is blocking development and release of a production application because required Knowledge files cannot be registered.

I would like to know:

  1. Is this a known File Search ingestion issue?
  2. Is there any known condition that causes “Failed to count tokens” only for specific valid files?
  3. Is there any workaround that does not require splitting or rewriting the original document?
  4. Is there an estimated fix timeline if this is a known backend issue?

Thank you.