diff --git a/qdrant_client/local/local_collection.py b/qdrant_client/local/local_collection.py index b0dcba22..2e323874 100644 --- a/qdrant_client/local/local_collection.py +++ b/qdrant_client/local/local_collection.py @@ -2148,6 +2148,8 @@ def _upsert_point(self, point: models.PointStruct) -> None: "Wrong input: Unnamed vectors are not allowed when a collection has named vectors or multivectors: " f"{vector_names}, {multivector_names}" ) + if not self.vectors and not self.multivectors: + raise ValueError(f"Wrong input: Not existing vector name error") if point.id in self.ids: self._update_point(point) diff --git a/tests/congruence_tests/test_updates.py b/tests/congruence_tests/test_updates.py index 1896eb1b..6319c485 100644 --- a/tests/congruence_tests/test_updates.py +++ b/tests/congruence_tests/test_updates.py @@ -338,3 +338,24 @@ def test_upload_wrong_vectors(): wrong_vectors_collection, points=[models.PointStruct(id=1, vector=unnamed_vector)], ) + + +def test_upsert_without_vector_name(): + local_client = init_local() + remote_client = init_remote() + + local_client.create_collection(collection_name=COLLECTION_NAME, vectors_config={}) + if remote_client.collection_exists(collection_name=COLLECTION_NAME): + remote_client.delete_collection(collection_name=COLLECTION_NAME) + remote_client.create_collection(collection_name=COLLECTION_NAME, vectors_config={}) + + with pytest.raises(ValueError, match="Not existing vector name error"): + local_client.upsert( + COLLECTION_NAME, points=[models.PointStruct(id=1, vector=[0.1, 0.2, 0.3])] + ) + with pytest.raises( + qdrant_client.http.exceptions.UnexpectedResponse, match="Not existing vector name error" + ): + remote_client.upsert( + COLLECTION_NAME, points=[models.PointStruct(id=1, vector=[0.1, 0.2, 0.3])] + )