# Fix gemini-embedding-001 2,048-Token Silent Input Truncation (autoTruncate Data Loss)

> Google gemini-embedding-001 enforces a 2,048-token input window (4x smaller than OpenAI 8,191) and defaults to autoTruncate = true on Vertex AI, returning HTTP 200 OK while silently discarding every clause past token 2,048. Disable silent data loss with auto_truncate=False + count_tokens chunking, or switch to Voxell Forge structural parent-span ingest ($39/mo Builder annual).

Canonical URL: https://voxell.ai/errors/gemini-embedding-001-2048-token-silent-truncation/


## Why Migrating From OpenAI `8,191` Tokens to `gemini-embedding-001` Silently Drops `75%` of Long Chunks

Teams migrating pipelines tuned for `text-embedding-3-large` (`8,191` tokens) or `BGE-M3` (`8,192` tokens) send `3,000..6,000`-token Markdown files and legal sections into `gemini-embedding-001`. Because `autoTruncate` defaults to `true`, zero exceptions appear in logs while indemnify clauses, pricing footnotes, and bottom-of-file functions vanish from your vector index.

## Immediate Python Fix: Fail-Closed `count_tokens` Check + `1,800`-Token Sub-Span Pooling

```python
from google import genai
from google.genai import types

client = genai.Client()

def assert_within_gemini_window(text: str, max_tokens: int = 2048) -> int:
    tok = client.models.count_tokens(model="gemini-embedding-001", contents=text).total_tokens
    if tok > max_tokens:
        raise ValueError(f"Chunk has {tok} tokens (> {max_tokens}); split before embedding!")
    return tok
```

## Never Lose Tail Clauses: Voxell Forge Structure-Aware Parent-Span Retrieval

Voxell Forge splits long PDFs, contracts, and source files along AST and heading boundaries, conditions every child span with `C_corpus` (`99.04% Recall@20`), and returns full cited parent context (**$39/mo** Builder annual; **$199/mo** Team annual with `0.8849 nDCG@10` Max reranking).

## Related Optimization Guides, Calculators & Benchmarks

- **[gemini-embedding-001 2,048-Token Silent Truncation Deep Dive](/optimize/gemini-2048-token-silent-truncation-vs-openai-8191/)**
- **[OpenAI text-embedding-3-large vs gemini-embedding-001](/optimize/openai-text-embedding-3-large-vs-gemini-embedding-001/)**
- **[Gemini Embedding Cost Calculator](/tools/gemini-embedding-cost-calculator/)**
- **[Audit Your Docs or GitHub Repo Free](/audit/)**

## Frequently Asked Questions

### Does gemini-embedding-001 have a 32k token window like Gemini 2.5 Flash?

No. Despite sharing the Gemini brand name, gemini-embedding-001 enforces a strict 2,048-token maximum input context length per string.

### How do I detect if existing production rows were silently truncated by gemini-embedding-001?

Audit stored chunk character lengths in SQL: any prose chunk above ~8,500 characters or code/JSON chunk above ~3,200 characters almost certainly exceeded 2,048 tokens and lost its tail.

---

## Zero-Install Model Context Protocol (MCP) & Keyless Agent Verification

```bash
claude mcp add --transport http voxell-forge https://api.voxell.ai/mcp/try
```

- Keyless Retrieval Bake-Off: `POST https://api.voxell.ai/api/v1/agent/bakeoff`
- Keyless Contradiction X-Ray: `POST https://api.voxell.ai/api/v1/agent/xray`
- Machine-Readable Pricing JSON: `https://voxell.ai/api/v1/agent/pricing.json`
- Full LLM Authority Map: `https://voxell.ai/llms-full.txt`
