Internal error `Error while generating embeddings` on wrong url
Describe the bug
Trying to add an embedder with a wrong URL, I got an internal error on v1.8 rc-1 and rc-2 (but not rc-0)
To Reproduce Steps to reproduce the behavior:
Try to add the following embedder:
"default": {
"source": "ollama",
"url": "http://localhost:11434/api/embeddings",
"apiKey": "<your-ollama-api-key>",
"model": "nomic-embed-text",
"distribution": {
"mean": 0.7,
"sigma": 0.3
}
}
Then wait a bit for the task to fail. The task should say:
"error": {
"message": "internal: Error while generating embeddings: runtime error: could not determine model dimensions: test embedding failed with runtime error: could not reach embedding server: http://localhost:11434/api/embeddings: Connection Failed: Connect error: Address not available (os error 99).",
"code": "internal",
"type": "internal",
"link": "https://docs.meilisearch.com/errors#internal"
},
Expected behavior Not sure if this is an improvement or a regression, so not sure about the behaviour :)
Meilisearch version: v1.8.0-rc.1 & v1.8.0-rc.2
Hello,
it is expected that there is an error here. The input URL is wrong, so the operation cannot be expected to complete.
It is unexpected that the error is an internal error. It is unclear what kind of error it should be, probably a UserError?
The issue here could come from either:
- The user typing the wrong URL. OK for a
UserError - The network is down. Unclear what the error kind should be in the current error scheme.
As InternalError is going to get us bug reports, a quick fix could be to switch most embedder errors to UserErrors.
The defaults would need to be switched in this From impl
For a longer term fix, see #4620