This repository was archived by the owner on Jun 5, 2025. It is now read-only.
This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Handle the error in case the ollama URL is empty (or wrong/not accessible) #817
Open
Description
Describe the issue
I think this is a bug in the text that uncovers a bug in codegate:
decoded_line = ' {"error": "[Errno -2] Name or service not known", "type": "error", │ │
│ │ "choices": ['+2 │ │
│ │ e = IndexError('list index out of range') │ │
│ │ json_line = { │ │
│ │ │ 'error': '[Errno -2] Name or service not known', │ │
│ │ │ 'type': 'error', │ │
│ │ │ 'choices': [] │ │
│ │ } │ │
│ │ line = b'data: {"error": "[Errno -2] Name or service not known", "type": │ │
│ │ "error", "choice'+7 │ │
So what happens here is that we get a line and expect it to cointain choices
but it only contains an error
. We should handle the error, perhaps by raising an HTTP exception. But the root cause is that we cannot reach a service (or ollama can't?)
Originally posted by @jhrozek in #802 (comment)
Steps to Reproduce
Configure and run codegate with a wrong Ollama URL.
Operating System
Linux (Intel)
IDE and Version
Extension and Version
Provider
Ollama
Model
Codegate version
Logs
https://github.com/stacklok/codegate/actions/runs/13026634572/job/36336880374
Additional Context
This was found during CI so thus why there are not specific versions matched.