File Search Store: uploadToFileSearchStore returns 503 for files >10KB (still broken in Feb 2026)

Summary

fileSearchStores.uploadFile() / uploadToFileSearchStore() consistently returns 503 (“Failed to count tokens”) for files larger than ~10KB. This was originally reported in November 2025 (#109892) but remains unresolved as of February 2026.

Reproduction

  1. Create a File Search Store.

  2. Upload any file >10KB directly via fileSearchStores.uploadFile().

  3. Observe the 503 error.

Note: File type does not seem to matter—CSV, XLSX, and PDF all fail. Files under ~10KB succeed.

Environment

  • SDK: @google/genai (Node.js)

  • Model: gemini-3-flash-preview with File Search tool

  • Account: Pay-as-you-go.


Workaround

We had to implement a two-step upload process to get file uploads working in production:

JavaScript

// Step 1: Upload via Files API (this works for large files)
const uploadedFile = await ai.files.upload({
  file: blob,
  config: { mimeType, displayName: fileName },
});

// Step 2: Import into File Search Store
await ai.fileSearchStores.importFile({
  fileSearchStoreName: storeName,
  fileName: uploadedFile.name,
});

This works but adds unnecessary complexity and latency. The direct uploadToFileSearchStore method should be able to handle this without requiring a two-step workaround.

Previous report: 503 error with file search tool