You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(embedder): or-chain on numpy array raises 'truth value ambiguous' ValueError -- crashes every BgeM3 embed call #287
BgeM3Embedder.embed() at line 232 uses: dense = result.get("dense_vecs") or result.get("dense") or result.get("embeddings"). When FlagEmbedding returns dense_vecs as a non-empty 2D numpy array (which it does on success), Python evaluates bool(numpy_2d_array) for the or short-circuit, raising ValueError: The truth value of an array with more than one element is ambiguous. This makes every successful embed call crash.
Root cause
Fix #245 added the or-chain to probe multiple output keys. The or operator requires bool() evaluation which is ambiguous for multi-element numpy arrays.
Fix
ingestion/embedder.py line 232: use explicit None check instead of or:
dense = next((v for k in ("dense_vecs", "dense", "embeddings") if (v := result.get(k)) is not None), None)
Impact
Every document ingestion using BgeM3Embedder crashes with ValueError when FlagEmbedding returns numpy arrays (which is the default return type).
Activity
fix(sprint-r4): root-cause fixes for all 17 bugs from code review rou…
piyushmakhija28 commentedon Jun 21, 2026
Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)