Skip to content

BUG: MRRReranker.rerank_multivector raises IndexError on empty input list #3468

Description

@devteamaegis

What breaks

Calling MRRReranker.rerank_multivector([]) raises an IndexError: list index out of range instead of a descriptive error.

How to trigger

from lancedb.rerankers.mrr import MRRReranker
reranker = MRRReranker()
reranker.rerank_multivector([])  # IndexError: list index out of range

Traceback

File "lancedb/rerankers/mrr.py", line 128, in rerank_multivector
    if not all(isinstance(v, type(vector_results[0])) for v in vector_results):
                                    ~~~~~~~~~~~~~~^^^
IndexError: list index out of range

Root cause

On line 128 the type-homogeneity check uses all() which passes vacuously on an empty iterable. Execution then reaches line 134 which accesses vector_results[0] unconditionally, crashing with IndexError. There is no guard against an empty input list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions