Error using Postgres Chat Memory and Supabase for AI Tools Agent

Describe the problem/error/question

I have a previously working AI Agent that has access to some tools, and is hooked up to Supabase as a DB, and using Postgres Chat Memory also linked to Supabase. Now when I try to run the agent I get an error

“- Cannot use a pool after calling end on the pool
Cannot use a pool after calling end on the pool”

What is the error message (if any)?

“- Cannot use a pool after calling end on the pool
Cannot use a pool after calling end on the pool”

Error details

Other info

n8n version

1.74.1 (Self Hosted)

Time

1/15/2025, 4:10:04 PM

Error cause

{}

Error in sub-node ‘Postgres Chat Memory‘

Cannot use a pool after calling end on the pool
Open node

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:1.74.1 (Self Hosted)
  • Database (Supabase):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (railway.app - self hosted):
  • Operating system: mac os

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I am having the same issue after upgrading to 1.74.1 today. Only difference is that mine is cloud hosted.

1 Like

I have the same problem as well. After upgrading to 1.74.1 today, all my flows that I use postgres with AI agents have been presenting the same error.

  • n8n version:1.74.1 (Self Hosted)
  • **Database (Postgres via Supabase):
  • **n8n EXECUTIONS_PROCESS setting (default: main):
  • Running n8n via (Hetzner - self hosted):
  • **Operating system: Ubuntu 20.04.6
1 Like

Having the same issue here on cloud

1 Like

i have the same issue after the new update 1.74.1 (self hosted in a cloud vps server)

Hi guys, good news, we got a fix for this ready to be released. Hopefully will go out this week still.

Sorry for this and thanks for your patience :pray:

Is there a way to go back to version 1.40.0 for now?

1 Like

I have the same problem as well. After upgrading to 1.74.1 today, all my flows that I use postgres with AI agents have been presenting the same error.

  • n8n version:1.74.1 (Self Hosted)
  • **Database (Postgres via Supabase):

Hi everyone, we’ve just released the fix with version 1.75.1
If anyone can update and test again to see if it is resolved, we’d appreciate the feedback! :slight_smile:

I just upgraded my cloud to 1.75.1. Still the same issue where it works for one workflow query, then errors on the second one. “Cannot use a pool after calling end on the pool” on the Postgres Chat Memory node.

Still not working for me. Version 1.75.1 (cloud)

Are you seeing this issue with the regular postgres node as well? or only with the chat memory and AI tools ?

1 Like

In my workflow, I only have a Postgres Chat Memory node. If I restart and ask my chat window a question, it executes and answers as expected. No errors.

However when I open the Postgres Chat Memory node immediately after and click on the connection setting, this error is already there before I even attempt a second question in the chat window: Couldn’t connect with these settings: Connection pool of the database object has been destroyed.

I’ve tried both ports 5432 and 6543 with the same result.

If I wait a few minutes and hit the Retry button (to reconnect) it says: Connection tested successfully.

At that point, I can again run the chat window with a question and it works as well, no errors, unless I run a subsequent chat question immediately after. So strange that it disconnects from the database after a successful query. It’s like there’s a timeout issue of some sort. Sorry for rambling.

I only have Postgres Chat Memory node

It’s like we need a keepAlive option on the connection.

1 Like

There was an explicit call in the Postgres Chat Memory node that terminated the connection pool after every use. We accidentally missed deleting that one line, and now every call to that node terminates the pool, leading to any other postgres node that uses the same credentials also breaking.

We are fixing this here, and will backport the fix as soon as possible.

New version [email protected] got released which includes the GitHub PR 12674.

Please try upgrading to 1.74.3 or 1.75.2 :pray:t4:

1 Like

What is the line of code to upgrade to 1.75.2 version on docker compose ?