[GH-ISSUE #3469] [BUG]: Backend Error when detecting Ollama instances #2239

Closed
opened 2026-02-22 18:28:48 -05:00 by yindo · 2 comments
Owner

Originally created by @t73biz on GitHub (Mar 15, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3469

How are you running AnythingLLM?

Docker (local)

What happened?

I am running anythingllm within a docker container on an Ubuntu 24 instance with ollama v0.5.7
The local ollama instance is accessible at http://localhost:11434

When running the following command to stand up the docker instance, (I left out the -d param to be able to debug), I get an error in the console.

Run Command:

export STORAGE_LOCATION=$HOME/AnythingLLMDesktop/storage && \
mkdir -p $STORAGE_LOCATION && \
touch "$STORAGE_LOCATION/.env" && \
docker run -p 3001:3001 \
--cap-add SYS_ADMIN \
--add-host=host.docker.internal:host-gateway \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

Error:

[backend] error: TypeError: fetch failed
    at node:internal/deps/undici/undici:12625:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ollamaAIModels (/app/server/utils/helpers/customModels.js:346:18)
    at async getCustomModels (/app/server/utils/helpers/customModels.js:49:14)
    at async /app/server/endpoints/system.js:960:35

Are there known steps to reproduce?

Visit the http://localhost:3001/settings/llm-preference endpoint and select Ollama as the LLM Provider

Originally created by @t73biz on GitHub (Mar 15, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3469 ### How are you running AnythingLLM? Docker (local) ### What happened? I am running anythingllm within a docker container on an Ubuntu 24 instance with ollama v0.5.7 The local ollama instance is accessible at http://localhost:11434 When running the following command to stand up the docker instance, (I left out the -d param to be able to debug), I get an error in the console. Run Command: ``` export STORAGE_LOCATION=$HOME/AnythingLLMDesktop/storage && \ mkdir -p $STORAGE_LOCATION && \ touch "$STORAGE_LOCATION/.env" && \ docker run -p 3001:3001 \ --cap-add SYS_ADMIN \ --add-host=host.docker.internal:host-gateway \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ``` Error: ``` [backend] error: TypeError: fetch failed at node:internal/deps/undici/undici:12625:11 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ollamaAIModels (/app/server/utils/helpers/customModels.js:346:18) at async getCustomModels (/app/server/utils/helpers/customModels.js:49:14) at async /app/server/endpoints/system.js:960:35 ``` ### Are there known steps to reproduce? Visit the `http://localhost:3001/settings/llm-preference` endpoint and select Ollama as the LLM Provider
yindo added the possible bug label 2026-02-22 18:28:48 -05:00
yindo closed this issue 2026-02-22 18:28:48 -05:00
Author
Owner

@t73biz commented on GitHub (Mar 15, 2025):

ok after quite a bit of fussing, this was the command that allowed for ollama to be access from the host through to the docker container.

export STORAGE_LOCATION=$HOME/AnythingLLMDesktop/storage && \
mkdir -p $STORAGE_LOCATION && \
touch "$STORAGE_LOCATION/.env" && \
docker run --rm -d -p 3001:3001 \
--cap-add SYS_ADMIN \
--network=host \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm

The difference here is the --network=host \ and then I was able to run with the ollama config url value of http://localhost:11434

I'm not sure if this is secure for production. My gut says no, but it does work locally

@t73biz commented on GitHub (Mar 15, 2025): ok after quite a bit of fussing, this was the command that allowed for ollama to be access from the host through to the docker container. ``` export STORAGE_LOCATION=$HOME/AnythingLLMDesktop/storage && \ mkdir -p $STORAGE_LOCATION && \ touch "$STORAGE_LOCATION/.env" && \ docker run --rm -d -p 3001:3001 \ --cap-add SYS_ADMIN \ --network=host \ -v ${STORAGE_LOCATION}:/app/server/storage \ -v ${STORAGE_LOCATION}/.env:/app/server/.env \ -e STORAGE_DIR="/app/server/storage" \ mintplexlabs/anythingllm ``` The difference here is the `--network=host \` and then I was able to run with the ollama config url value of `http://localhost:11434` I'm not sure if this is secure for production. My gut says no, but it does work locally
Author
Owner

@timothycarambat commented on GitHub (Mar 17, 2025):

That is the correct solution, otherwise the local network loopback will keep using the container network and not the host network (where Ollama is running)

@timothycarambat commented on GitHub (Mar 17, 2025): That is the correct solution, otherwise the local network loopback will keep using the container network and not the host network (where Ollama is running)
yindo changed title from [BUG]: Backend Error when detecting Ollama instances to [GH-ISSUE #3469] [BUG]: Backend Error when detecting Ollama instances 2026-06-05 14:45:23 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2239