fix(qdrant): reject empty vectors in upsert_points

Prevent Qdrant from rejecting entire batches when any point
has an empty vector. Log error with count before failing.
This commit is contained in:
ZhenYi 2026-04-29 15:35:22 +08:00
parent 395832118e
commit 6a60d02263

View File

@ -89,6 +89,16 @@ impl QdrantClient {
return Ok(());
}
// Reject empty vectors — they cause Qdrant to reject the entire batch
let empty_vectors = points.iter().filter(|p| p.vector.is_empty()).count();
if empty_vectors > 0 {
tracing::error!(empty_count = empty_vectors, total = points.len(), "upsert_points: REJECTING points with empty vectors");
return Err(crate::AgentError::Qdrant(format!(
"refusing to upsert {} points with empty vectors",
empty_vectors
)));
}
let collection_name = Self::collection_name(&points[0].payload.entity_type);
self.upsert_to_collection(&collection_name, points).await
}