Immich getting ECONNREFUSED in logs when trying to connect to POSTGRESSQL
Has been working for ages but randomly noticed it had stopped. I have both containers in a custom docker network. Why is this happening?
Error: connect ECONNREFUSED 172.18.0.10:5433
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '172.18.0.10',
port: 5433
}
21 Replies
:wave: Hey @BATSO,
Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:.
References
- Container Logs:
docker compose logs
docs
- Container Status: docker ps -a
docs
- Reverse Proxy: https://immich.app/docs/administration/reverse-proxy
- Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA
Checklist
I have...
1. :blue_square: verified I'm on the latest release(note that mobile app releases may take some time).
2. :blue_square: read applicable release notes.
3. :blue_square: reviewed the FAQs for known issues.
4. :blue_square: reviewed Github for known issues.
5. :blue_square: tried accessing Immich via local ip (without a custom reverse proxy).
6. :blue_square: uploaded the relevant information (see below).
7. :blue_square: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable
(an item can be marked as "complete" by reacting with the appropriate number)
Information
In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider:
- Your docker-compose.yml and .env files.
- Logs from all the containers and their status (see above).
- All the troubleshooting steps you've tried so far.
- Any recent changes you've made to Immich or your system.
- Details about your system (both software/OS and hardware).
- Details about your storage (filesystems, type of disks, output of commands like fdisk -l
and df -h
).
- The version of the Immich server, mobile app, and other relevant pieces.
- Any other information that you think might be relevant.
Please paste files and logs with proper code formatting, and especially avoid blurry screenshots.
Without the right information we can't work out what the problem is. Help us help you ;)
If this ticket can be closed you can use the /close
command, and re-open it later if needed.Hey!
Please follow the post above
Please carefully read this message and follow the recommended actions.In particular, sections "References" and "Information" It seems you have custom setup (
port: 5433
), so without the troubleshooting info mentioned above^^^ it wouls be difficult to say anything definite. Apart from the suggesting to check if Postgres is unhealthy / down or network connectivity is broken.I use Unraid and have recently changed to using a custom docker network. I have changed back to using bridge and host networks but no change.
There the templates for my PostgresSQL and Immich
If my database is corrupt, will I just be able to reinstall it?
Or will I use my photos
It is possible to restore the database using backups that Immich automatically creates every night by default (at .../immichphotos/backups if I correctly read your config)
1. Are you suspecting DB corruption?
2. What is in Postgres logs?
3. Anything in Immich logs apart from ECONNREFUSED to Postgres?
2025-09-07 15:04:46.077 AEST [1] LOG: redirecting log output to logging collector process
2025-09-07 15:04:46.077 AEST [1] HINT: Future log output will appear in directory "log".
2025-09-07 15:07:31.741 AEST [1] LOG: redirecting log output to logging collector process
2025-09-07 15:07:31.741 AEST [1] HINT: Future log output will appear in directory "log".
2025-09-07 15:07:41.121 AEST [1] LOG: redirecting log output to logging collector process
2025-09-07 15:07:41.121 AEST [1] HINT: Future log output will appear in directory "log".
PostgreSQL Database directory appears to contain a database; Skipping initialization
PostgreSQL Database directory appears to contain a database; Skipping initialization
PostgreSQL Database directory appears to contain a database; Skipping initialization
This is all thats in the Postgres logs
api worker exited with code 1
Starting api worker
[Nest] 203465 - 09/07/2025, 10:17:17 PM LOG [Api:EventRepository] Initialized websocket server
Error: connect ECONNREFUSED 172.18.0.10:5433
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '172.18.0.10',
port: 5433
}
Is allthat is repeated in the Immich logs
Re: Postgres logs
Future log output will appear in directory "log".
Seems your Postgres on unraid writes logs to file system, in the "log" directory in Postgres data dir.Is the Postgres DB assigned a static IP in Unraid? Does the IP address of the Postgres container match the error?
If they are in the same docker network, I actually prefer to use the image name to avoid IP conflicts
This is the postgres logs
Yeah I have been using the container name

I tried changing the DB port in immich to 5432. I am now getting a different error. Not sure if its a better error to be getting?
So the Postgres db/container is healthy - based on the logs and your next step (port 5432) 👍
As your next error demonstrates, Immich is talking to the database, now it's not happy with the upgrade path.
Perhaps you jumped through too many versions / breaking changes.
What is/was your initial/current version?
As the error message in log says
Error: Invalid upgrade path. For more information, see https://immich.app/errors#typeorm-upgradeFollow the linked article, most likely you need to upgrade to any version in the range { v1.132.3 ... v1.136.0 } first Regarding your networking setup, let's see if @ teh g can suggest anything based on the recent info.
Does the IP of the Postgres container match the error?
i have this exact problem... any tutorial for that step?
Do i compose down, and then compose pull the right version?
i have this exact problemCould you provide a detailed description of the problem? To be on the same page. Also information mentioned in the post from bot https://discord.com/channels/979116623879368755/1414117590808399916/1414117593043828737 would be useful.
i just gave up.
Short Story:
-i was running big bear immich on CasaOS, had lost root passwd and didnt proper now how docker-compose works so i neglected updates from 1.121 and jump straight to 1.143. Docker was running but i couldnt connect.
-Formatted everything, installed Ubuntu Server, immich as instructed in the website, restored backup, still off. meddled with compose.yml file as per instructed in all change-logs along the way and still, docker running but unable to access the app.
-I just decided to delete again and start a new docker from scratch straight on 2.0, its working now and i plan to not neglect it anyway, nor forgett the root password. 😂
In a few hours in plan to use immich-go to import my google photos takeout... worked last year... lets pray its still do
learned a lot in this journey that were consequences of my actions
Thanks for sharing! Enjoy your Immich setup and good luck 😃
In the future you can check
docker compose logs
for errors and search the error message here on Discord or on Immich Github.