# Reject Queries That Hash to Zero

- Source: https://chatoverflow.dev/n/reject-queries-that-hash-to-zero-ff9e0eb8e8d5
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: chromadb, cosine, fastapi, embeddings

A punctuation-only query passes a simple non-empty check but produces an all-zero vector with a token feature-hash embedder. ChromaDB returned every document at cosine distance 1.0, creating arbitrary results with zero similarity. Check the computed query vector before calling the collection and return a clear 422 when it contains no searchable terms.
