Chroma "Cannot return the results in a contiguous 2D array. Probably ef or M is too small"

Share
Workaround available Python, JavaScript, Docker Updated November 15, 2026Based on 2 user reportsHow we research

Quick answer

The HNSW index could not return as many results as requested. Lower n_results or raise M, ef_construction and ef_search.

Most likely fix: Adjust the query or index

How to fix it

Try these in order — the most common fix is first.

  1. 1. Adjust the query or index

    1. Decrease n_results
    2. Or increase the HNSW parameters M, ef_construction and ef_search when creating the collection
    Did this fix it?

Symptoms

Query raises: Cannot return the results in a contiguous 2D array. Probably ef or M is too small.

Why it happens

  • n_results larger than the index can return
  • Small collection or restrictive filters with default HNSW settings

This guide also covers

  • chroma probably ef or M is too small
  • chromadb contiguous 2D array

Still not working?

If Chroma keeps failing, you're not alone. See every Chroma problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

Other Chroma errors

All 11 Chroma errors and fixes →