Describe the problem/error/question
I am trying to hand over a vector to a POST http request node.
The vector is actually coming from an ebbeding model that I run to turn my query into a vector to then retrieve the answer from my chromadb.
But I simplified it here replicating the same error with a much simpler setup.
I always get the error immediately after executing the http request.
In the end I made a very simple simulation with only two nodes: a Set or Code node and the POST node. This would replicate the error.
My input data looks like this:
[{
“query_embeddings”: [[ 1,2,3,4 ]],
“n_results”: 5,
“include”: [
“metadatas”,
“documents”
]
}]
I tried a lot to change specific format bits as gemini and chatgpt told me to:
making distinctions between array and top-level object and that subtle difference — []
wrapping the object — causes the 422. Nothing helped.
In the expression editor eveything looks good:
expression
{{ $json }}
result
[Object: {“query_embeddings”: [[1,2,3,4]], “n_results”: 5, “include”: [“metadatas”, “documents”]}]
The error message: 422
"{
"error":"ChromaError",
"message":"Failed to deserialize the JSON body into the target type: missing field `query_embeddings` at line 1 column 7"
}"
Request:
{ "body": { "": "" },
"headers": {
"accept": "application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7"
},
"method": "POST",
"uri": "http://192.168.10.123:8060/api/v2/tenants/default_tenant/databases/default_database/collections/<mycollectionid>/query",
"gzip": true,
"rejectUnauthorized": true,
"followRedirect": true, "resolveWithFullResponse": true,
"followAllRedirects": true,
"timeout": 300000,
"encoding": null,
"json": false,
"useStream": true
}
My two nodes
n8n setup
- n8n version: 1.101.2
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Self hosted npm
- Operating system: Debian Bookworm