Ollama Integration Issue
C:\Users\Admin>ollama list NAME ID SIZE MODIFIED qwen3-coder:480b-cloud e30e45586389 - 6 days ago deepseek-v3.1:671b-cloud d3749919e45f - 6 days ago gpt-oss:120b-cloud 569662207105 - 6 days ago gpt-oss:20b-cloud 875e8e3a629a - 6 days ago
C:\Users\Admin>curl http://localhost:11434 Ollama is running C:\Users\Admin>curl http://127.0.0.1:11434 Ollama is running C:\Users\Admin>
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: OllamaException - Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)]
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: OllamaException - Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)]
Text litellm.APIConnectionError: OllamaException - Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)] Traceback (most recent call last): Traceback (most recent call last): File "/[opt](http://localhost:32770/#)/[venv-a0](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[site-packages](http://localhost:32770/#)/[aiohttp](http://localhost:32770/#)/[connector.py](http://localhost:32770/#)", line 1268, in _wrap_create_connection sock = await aiohappyeyeballs.start_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/[opt](http://localhost:32770/#)/[venv-a0](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[site-packages](http://localhost:32770/#)/[aiohappyeyeballs](http://localhost:32770/#)/[impl.py](http://localhost:32770/#)", line 122, in start_connection raise first_exception File "/[opt](http://localhost:32770/#)/[venv-a0](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[site-packages](http://localhost:32770/#)/[aiohappyeyeballs](http://localhost:32770/#)/[impl.py](http://localhost:32770/#)", line 73, in start_connection sock = await _connect_sock( ^^^^^^^^^^^^^^^^^^^^ File "/[opt](http://localhost:32770/#)/[venv-a0](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[site-packages](http://localhost:32770/#)/[aiohappyeyeballs](http://localhost:32770/#)/[impl.py](http://localhost:32770/#)", line 208, in _connect_sock await loop.sock_connect(sock, address) File "/[opt](http://localhost:32770/#)/[pyenv](http://localhost:32770/#)/[versions](http://localhost:32770/#)/[3.12.4](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[asyncio](http://localhost:32770/#)/[selector_events.py](http://localhost:32770/#)", line 651, in sock_connect return await fut ^^^^^^^^^ File "/[opt](http://localhost:32770/#)/[pyenv](http://localhost:32770/#)/[versions](http://localhost:32770/#)/[3.12.4](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[asyncio](http://localhost:32770/#)/[futures.py](http://localhost:32770/#)", line 287, in __await__ yield self # This tells Task to wait for completion. ^^^^^^^^^^ File "/[opt](http://localhost:32770/#)/[pyenv](http://localhost:32770/#)/[versions](http://localhost:32770/#)/[3.12.4](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[asyncio](http://localhost:32770/#)/[tasks.py](http://localhost:32770/#)", line 385, in __wakeup future.result() File "/[opt](http://localhost:32770/#)/[pyenv](http://localhost:32770/#)/[versions](http://localhost:32770/#)/[3.12.4](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[asyncio](http://localhost:32770/#)/[futures.py](http://localhost:32770/#)", line 203, in result raise self._exception.with_traceback(self._exception_tb) File "/[opt](http://localhost:32770/#)/[pyenv](http://localhost:32770/#)/[versions](http://localhost:32770/#)/[3.12.4](http://localhost:32770/#)/[lib](http://localhost:32770/#)/[python3.12](http://localhost:32770/#)/[asyncio](http://localhost:32770/#)/[selector_events.py](http://localhost:32770/#)", line 691, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 11434)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/aiohttp_transport.py", line 59, in map_aiohttp_exceptions yield File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/aiohttp_transport.py", line 213, in handle_async_request response = await client_session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/client.py", line 1488, in aenter self._resp: _RetType = await self._coro ^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/client.py", line 770, in _request resp = await handler(req) ^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/client.py", line 725, in _connect_and_send_request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/connector.py", line 642, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_connection _, proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/connector.py", line 1581, in _create_direct_connection raise last_exc File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/connector.py", line 1550, in _create_direct_connection transp, proto = await self._wrap_create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/aiohttp/connector.py", line 1291, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 114, in _make_common_async_call response = await async_httpx_client.post( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/logging_utils.py", line 135, in async_wrapper result = await func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/http_handler.py", line 288, in post return await self.single_connection_post_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/http_handler.py", line 513, in single_connection_post_request response = await client.send(req, stream=stream) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/httpx/_client.py", line 1629, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/httpx/_client.py", line 1657, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/httpx/_client.py", line 1694, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/httpx/_client.py", line 1730, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/aiohttp_transport.py", line 206, in handle_async_request with map_aiohttp_exceptions(): File "/opt/pyenv/versions/3.12.4/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/aiohttp_transport.py", line 73, in map_aiohttp_exceptions raise mapped_exc(message) from exc httpx.ConnectError: Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)]
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/opt/venv-a0/lib/python3.12/site-packages/litellm/main.py", line 544, in acompletion response = await init_response ^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 604, in acompletion_stream_function completion_stream, _response_headers = await self.make_async_call_stream_helper( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/llms/custom_httpx/llm_http_handler.py", line 663, in make_async_call_stream_helper response = await self._make_common_async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 stack lines skipped <<<
File "/a0/models.py", line 499, in unified_call _completion = await acompletion( ^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/utils.py", line 1586, in wrapper_async raise e File "/opt/venv-a0/lib/python3.12/site-packages/litellm/utils.py", line 1437, in wrapper_async result = await original_function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/main.py", line 563, in acompletion raise exception_type( ^^^^^^^^^^^^^^^ File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2301, in exception_type raise e File "/opt/venv-a0/lib/python3.12/site-packages/litellm/litellm_core_utils/exception_mapping_utils.py", line 2270, in exception_type raise APIConnectionError( litellm.exceptions.APIConnectionError: litellm.APIConnectionError: OllamaException - Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)]
litellm.exceptions.APIConnectionError: litellm.APIConnectionError: OllamaException - Cannot connect to host localhost:11434 ssl:default [Connect call failed ('127.0.0.1', 11434)]
More information about your Agent Zero/Ollama deployment would clarify. WSL, docker, etc.
Running Agent Zero in an isolated network ( not bridge/host network ) would explain this.
I'm experiencing this exact issue. I have Ollama running on a host, accessible via DNS in my internal network. The a0 container can reach it, however the UI throws this exact error.
Setup
- a0 running in docker container
- port 56000
- pulled on 2025-11-11
- http://host.domain:11434 is configured under Chat model base URL
- most other things are default
- ollama running on host.domain:11434
error
litellm.APIConnectionError: OllamaException - Request URL is missing an 'http://' or 'https://' protocol.
Traceback (most recent call last):
Traceback (most recent call last):
File "/[opt](http://localhost:56000/#)/[venv-a0](http://localhost:56000/#)/[lib](http://localhost:56000/#)/[python3.12](http://localhost:56000/#)/[site-packages](http://localhost:56000/#)/[httpx](http://localhost:56000/#)/[_transports](http://localhost:56000/#)/[default.py](http://localhost:56000/#)", line 101, in map_httpcore_exceptions
yield
File "/[opt](http://localhost:56000/#)/[venv-a0](http://localhost:56000/#)/[lib](http://localhost:56000/#)/[python3.12](http://localhost:56000/#)/[site-packages](http://localhost:56000/#)/[httpx](http://localhost:56000/#)/[_transports](http://localhost:56000/#)/[default.py](http://localhost:56000/#)", line 250, in handle_request
resp = self._pool.handle_request(req)
...
troubleshooting
Access the shell on the running a0 container with ID 0547509942b6
1. docker exec -it 0547 bash
2. (venv) root@0547509942b6:/# curl http://host.domain:11434
Ollama is running