PATCH on a multi-tenant collection re-vectorizes the object even when no source property changed
How to reproduce this bug?
On a multi-tenant collection, a partial update (PATCH /v1/objects/{className}/{id}, which is what collection.data.update() in the Python client sends) re-runs the vectorizer for every vectorizer-backed vector not supplied in the request, even when none of that vector's source properties changed. On a single-tenant collection the same PATCH reuses the stored vectors.
Start Weaviate with no OpenAI key configured, so any vectorizer call shows up as an error:
docker run --rm -p 8080:8080 cr.weaviate.io/semitechnologies/weaviate:1.39.4- Create a multi-tenant collection with a named vector sourced only from
body, plus a tenant:
curl -X POST localhost:8080/v1/schema -H 'Content-Type: application/json' -d '{
"class": "Doc",
"multiTenancyConfig": {"enabled": true},
"properties": [
{"name": "body", "dataType": ["text"]},
{"name": "tag_ids", "dataType": ["uuid[]"]}
],
"vectorConfig": {
"body_vec": {
"vectorizer": {"text2vec-openai": {"properties": ["body"]}},
"vectorIndexType": "hnsw"
}
}
}'
curl -X POST localhost:8080/v1/schema/Doc/tenants -H 'Content-Type: application/json' -d '[{"name": "t1"}]'- Insert an object with its vector supplied, so no vectorizer call is needed:
curl -X POST localhost:8080/v1/objects -H 'Content-Type: application/json' -d '{
"class": "Doc", "tenant": "t1",
"id": "6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"properties": {"body": "hello world", "tag_ids": ["0a1b2c3d-4e5f-4a6b-8c7d-8e9f0a1b2c3d"]},
"vectors": {"body_vec": [0.1, 0.2, 0.3]}
}'- PATCH only
tag_ids, which is not a source property. The tenant goes in the body because the PATCH endpoint has notenantquery parameter (the Python client sends it the same way):
curl -X PATCH localhost:8080/v1/objects/Doc/6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b -H 'Content-Type: application/json' -d '{
"class": "Doc", "tenant": "t1",
"properties": {"tag_ids": ["1b2c3d4e-5f6a-4b7c-9d8e-9f0a1b2c3d4e"]}
}'To compare, run the same steps on a single-tenant collection (no multiTenancyConfig, no tenant-creation call, no "tenant"): the PATCH returns 204 and the vectorizer is never called.
What is the expected behavior?
The PATCH returns 204 without calling the vectorizer: when none of a vector's source properties changed, the stored vector should be reused. That is what already happens for PATCH on a single-tenant collection, and for PUT and batch on the same multi-tenant collection (default REVECTORIZE_CHECK_DISABLED=false).
What is the actual behavior?
The PATCH returns HTTP 500 and the update is not saved (tag_ids keeps its old value):
msg:merge and vectorize code:500 err:vectorize target vector body_vec: update vector: API Key: no api key found neither in request header: X-Openai-Api-Key nor in environment variable under OPENAI_APIKEYWhen the embedding call succeeds (measured with the call-counting mock below, which returns vectors of the collection's dimension), the PATCH returns 204, so the caller sees nothing wrong. But it makes one embedding call per vectorizer-backed vector and overwrites the stored vectors, including ones supplied at insert, with new embeddings of the unchanged text.
Supporting information
- Embedding calls per PATCH, measured with a dummy key and a call-counting mock set as the module's
baseURL, on multi-tenant and single-tenant collections with two named vectors (same on 1.39.4 and 1.39.7):- non-source
uuid[]property changed: multi-tenant 2, single-tenant 0 - non-source
textproperty changed: multi-tenant 2, single-tenant 0 - source of one named vector changed: multi-tenant 2 (both vectors re-embedded), single-tenant 1
- non-source
- PUT and REST batch on the same multi-tenant collection behave correctly: 0 calls when source text is unchanged, and only the changed vector is re-embedded otherwise.
- The legacy class-level
vectorizeris affected the same way. - Workaround: for a PATCH that doesn't touch source properties, include every existing vector in the body (any vector left out is still re-embedded), or use PUT/batch with the full object.
- Cause:
mergeObjectSchemaAndVectorizebuilds the object it passes toUpdateVectorwithoutTenant(merge.go#L252-L253), so the stored-object lookups inreVectorizeEmbeddingsrun with an empty tenant (compare.go#L250-L265). On a multi-tenant class those lookups error, and any lookup error falls back to re-vectorizing, so the stored vector is never reused. - Not run on main, but the code involved is unchanged on main and v1.40.0-rc.1 as of 2026-09-29. By code reading, 1.37 and 1.38 also build this object without
Tenant(only 1.39.4 and 1.39.7 were reproduced). - Same symptom as #11781, different cause. #11781 still shows open, but its fix #11789 is in 1.39.3+ (so in both versions here), and the single-tenant control above passes.
- Fix: passing the tenant
patchObjectalready has through to that object fixes it. Tested on v1.39.4: the repro PATCH returns 204 with no vectorizer call, a PATCH that changes the source of one of two named vectors re-embeds only that vector, and theusecases/objectsandusecases/modulestests pass. PR to follow.
Server Version
1.39.4, 1.39.7
Weaviate Setup
Single Node
Nodes count
1
Code of Conduct
- I have read and agree to the Weaviate's Contributor Guide and Code of Conduct
Source: weaviate/weaviate