#781·zvec

Bug: Collection.group_by_query returns empty results with ID-out-of-range errors (UINT64_MAX)

Author: daqidaliCreated Sep 24, 2026Updated Sep 29, 2026
Labelsbug

Description

Zvec version: 0.7.0 (Python 3.14, Linux x86_64)

Collection.group_by_query (introduced in 0.6.0, refactored in 0.7.0) always returns an empty list on real collections, while the C layer floods the log with:

[ERROR doc_filter.cc:104] ID is out or range: id[18446744073709551615] count[668]

18446744073709551615 is UINT64_MAX — it looks like an internal sentinel ID is being fed into doc filtering as a real document ID.

Expected: group_by_query returns up to group_count groups, each with topk_per_group docs, ordered by similarity score. Actual: empty list + the errors above.

I confirmed this on two collections (plain HNSW, COSINE metric; group field is a non-null STRING). Plain coll.query() on the same collections returns correct top-k results, so the index and data are fine.

Steps to Reproduce

python
1. Install zvec 0.7.0 (pip install zvec==0.7.0)
2. Open an existing collection (e.g. created via zvec API with HNSW + COSINE, a STRING field "model", and a vector field dim 768)
3. Run:


import zvec, os
coll = zvec.open(os.path.join(DB, 'bt_speakers_img2img'), option=zvec.CollectionOption(enable_mmap=1, read_only=1))
first = next(coll.iter_docs())
vec = first.vector('siglip2_embedding')
groups = coll.group_by_query(
    zvec.Query(field_name='siglip2_embedding', vector=vec),
    group_by_field_name='model',
    group_count=3,
    topk_per_group=1,
)
print(len(groups))  # expected 3, actual 0


4. Observe: `len(groups) == 0` and repeated `[ERROR doc_filter.cc:104] ID is out or range: id[18446744073709551615]` lines.

Logs / Stack Trace

bash
[ERROR 2026-09-24 15:19:06 doc_filter.cc:104] ID is out or range: id[18446744073709551615] count[668]
[ERROR 2026-09-24 15:19:06 doc_filter.cc:104] ID is out or range: id[18446744073709551615] count[668]
...

The errors repeat dozens of times (once per candidate group), then group_by_query returns an empty list.

Operating System

Linux (Ubuntu 26.04 / WSL2), x86_64

Build & Runtime Environment

Python 3.14 (project venv), pip install zvec==0.7.0, Linux x86_64 (Ubuntu 26.04 / WSL2), stock wheel (no local build)

Additional Context

  • I've checked git status — no uncommitted submodule changes
  • I built with CMAKE_BUILD_TYPE=Debug
  • This occurs with or without COVERAGE=ON
  • The issue involves Python ↔ C++ integration (pybind11)