Issue with Node (When chat message received)

Describe the problem/error/question

Hello, I am encountering an issue with the node (when chat message received). I am hosting n8n on docker on a VM in local. My issue is that the node by herself isn’t working. When i put a chat, a message pops up and says waiting for you to submit the chat and in the chat overlay the response has failed to receive response. After many research on the net i found out that when i send a message in the web console this error pops out Chat API error type error failed to fetch. I have no clue how to fix this if anyone has one i would appreciat to share it with me.

n8n install on premise

  • n8n EXECUTIONS_PROCESS setting (default)
  • Running n8n via Docker
  • Operating system: debian

welcome to the n8n community @ungelast
I would first fix the instance’s public editor/webhook URL settings (N8N_HOST, N8N_PROTOCOL, and, if applicable, WEBHOOK_URL plus N8N_PROXY_HOPS=1) and make sure the browser can reach that public URL from the VM setup, because the Chat Trigger UI posts back to n8n over the browser-facing endpoint and a wrong/self-local URL commonly shows up as Chat API error: Failed to fetch in self-hosted Docker installs.

Hi @ungelast Welcome!
Consider upgrading your n8n to the latest 2.x.x version, and then let us know if this issue still persists.

this is almost always a networking/URL config issue with docker. the chat node needs to call back to your n8n instance from the browser, and if the URL isn’t set correctly it can’t reach it.
check your WEBHOOK_URL and N8N_EDITOR_BASE_URL environment variables in your docker config. they need to be set to the URL that your browser can actually reach not localhost inside the container, but the actual IP or domain you’re using to access n8n. if you’re accessing it via something like http://192.168.1.50:5678, both those vars should be set to that.

also make sure your docker port mapping is correct for the webhook port, not just the editor port. the chat node uses the webhook endpoint under the hood so if that port isn’t exposed or mapped properly you’ll get exactly this “failed to fetch” error.
quick test open your browser console, look at what URL the chat is trying to reach when you send a message. if it’s hitting localhost or some internal docker IP, that’s your problem right there.

Thank you very much just by defining the N8N_HOST with the local IP did solve my problem.

Awesome, glad that fixed it! Docker networking with n8n can be super confusing the first time you set it up. Good luck with the rest of your build

ungelast, your setup looks fine and Ollama is working, so this is not a model issue

The error “Failed to fetch” is coming from the chat UI, not from your workflow. It means the browser cannot reach the n8n backend when using Test Chat. That’s why it works when you click “Execute workflow”, but fails in chat mode.

Since you’re running n8n in Docker on a VM, this is most likely a URL or port mismatch. The chat UI is trying to call the backend using a URL that is not accessible from your browser.

What you should do is make sure n8n is exposed correctly and using the right public URL. In your setup, set:

N8N_HOST=192.168.1.65

N8N_PORT=5678

N8N_PROTOCOL=http

WEBHOOK_URL=http://192.168.1.65:5678/

Also make sure Docker is exposing the port:

-p 5678:5678

Then open n8n in your browser using:

http://192.168.1.65:5678

(not localhost)

After that, try Test Chat again

This issue happens because the chat feature depends on the browser calling the backend API, and if the URL is wrong or not reachable, it fails with “Failed to fetch” even though everything else is working

If it still fails, check your browser console (F12 → Network) and you will see the request that is failing, that will confirm the exact cause