Troubleshooting
Why Node-RED on ctrlX COREvirtual cannot reach PostgreSQL
Short answer
The refusal comes from the destination, not from PostgreSQL: 127.0.0.1 inside ctrlX COREvirtual is the virtual controller itself, so Node-RED dials a guest loopback where nothing listens. From the QEMU guest the Windows host is always 10.0.2.2, so point node-red-contrib-re-postgres at 10.0.2.2:5432. A port-forwarding entry reads host port first, guest port second, and a boot failure naming a rule means that host port is already taken.

On this page
- What the refusal actually tells you
- Where the Windows host address comes from
- Worked example: tracing 127.0.0.1:5432 from the QEMU guest to the Windows host
- Reading a port-forwarding entry
- Why the controller refuses to boot with the rule added
- Verify the route end to end
- The decision, case by case
- Questions asked
Node-RED inside ctrlX COREvirtual reports connect ECONNREFUSED 127.0.0.1:5432 because the PostgreSQL node is dialing the virtual controller's own loopback, and nothing inside the guest listens on that port. The database runs on the Windows host, and the QEMU guest reaches that host at the fixed address 10.0.2.2, so the working destination is 10.0.2.2:5432. Point node-red-contrib-re-postgres at that address and the queries run, with no port-forwarding entry involved at all. Forwarding entries read the other way round — Windows-side port first, controller-side port second — and they carry traffic from the host into the controller, never the other way. If the controller refuses to boot after you add a rule, the rule's Windows-side port is already owned by another process; the flow is not the cause.
What the refusal actually tells you #
ECONNREFUSED is not a timeout and not a login failure. The guest's own TCP stack answered the connection attempt and reported that nothing accepted on the configured endpoint. PostgreSQL never saw the attempt: no credential and no query reached it, so nothing you change in the flow, the SQL, or the database account can fix it.
Loopback always means this machine. On the Windows PC, 127.0.0.1 is the PC itself, which is why the same flow with the same node works when you run Node-RED directly on Windows. Inside ctrlX COREvirtual, the same address belongs to the virtual controller — a machine that runs no PostgreSQL — so its kernel refuses the connection and the node reports the endpoint it tried: connect ECONNREFUSED 127.0.0.1:5432.
The same refusal appears on ordinary plant networks when Node-RED targets a database on another machine; Fix ECONNREFUSED when Node-RED connects to a remote SQL database covers that case. The twist here is that the remote machine is the very PC hosting the virtual controller.
Where the Windows host address comes from #
ctrlX COREvirtual runs as a QEMU virtual machine with its own virtual network, and the ctrlX COREvirtual documentation defines that network precisely: the DHCP server assigns the controller an address from 10.0.2.15 upward, and from the controller's point of view the address 10.0.2.2 corresponds to the localhost of the host PC. The guest's connection to that alias is handed over on the host's own loopback path, so a PostgreSQL listener bound to the Windows loopback answers, and no Windows Firewall exception is normally needed — the connection does not arrive from the network, it arrives from the host itself.
This address is a property of the virtual machine, not of your plant network. A physical ctrlX CORE sits on the LAN like any device and reaches the PC by the PC's LAN address; Connect Node-RED on ctrlX CORE to a MySQL server shows that setup. Never copy the alias onto a physical controller, and never copy a LAN address into the virtual one.
Whether the service on the Windows PC is actually listening is the same first question for every protocol; Why a device cannot publish MQTT to a broker on your PC works through it for MQTT brokers on a PC.
Worked example: tracing 127.0.0.1:5432 from the QEMU guest to the Windows host #
The inputs, each as reported for this case:
- Flow: node-red-contrib-re-postgres in Node-RED inside ctrlX COREvirtual, host field at 127.0.0.1, port field at 5432.
- Database: PostgreSQL on Windows, listening on 5432.
- Guest network: QEMU user networking, controller address from DHCP with first address 10.0.2.15, host loopback aliased at 10.0.2.2 — vendor documentation.
- Observed result: connect ECONNREFUSED 127.0.0.1:5432 in the debug panel.
The rule: a socket endpoint is an address plus a port, and the address is resolved inside the machine that opens the socket. Loopback inside the guest is the guest, not the host.
The arithmetic, one chain per destination:
- Configured 127.0.0.1:5432 → resolved inside the guest → the guest's own loopback, port 5432 → no listener on the virtual controller → kernel refuses → debug panel shows connect ECONNREFUSED 127.0.0.1:5432. Result: refused, and the query never ran.
- Corrected 10.0.2.2:5432 → resolved inside the guest → the host alias → the host's loopback, port 5432 → the PostgreSQL listener → connection accepted → the node authenticates → the query runs.
Same port number both times; the address alone decides which machine answers.
Decision: with the loopback host the route cannot work from the guest, so set the host field to the guest-to-host alias and keep the database port. The pass mark is query rows in the debug panel; a PostgreSQL error there means the route is finished and the database account is the next suspect.
Reading a port-forwarding entry #
In port-forwarding mode, Windows tools reach the virtual controller through forwarded ports; the documented host-side access to the controller's web interface is localhost on 8443. Each entry in the forwarding list names the Windows-side port on the left and the controller-side port on the right. The pairing used as an example in this case, 8022:22, lets a Windows SSH client reach the controller's SSH port.
That direction is why a forwarding entry could not help Node-RED reach PostgreSQL:
| Entry | Windows-side port | Controller-side port | What it does |
|---|---|---|---|
| 8022:22 | 8022 | 22 | Windows SSH client reaches the controller |
| 8444:5432 | 8444 | 5432 | Windows tools reach port 5432 inside the controller, not the database on Windows |
| 5432:5432 | 5432 | 5432 | Demands Windows port 5432, which PostgreSQL already owns |
An entry carries traffic from the host into the controller, never out of it. Node-RED needs the opposite direction, guest to host, and that direction does not pass through the forwarding list at all — it uses the host alias directly. The 8444:5432 attempt therefore failed twice over: the flow pointed at the guest loopback, and the mapping pointed the wrong way.
Why the controller refuses to boot with the rule added #
Creating a forwarding rule binds the Windows-side port on your PC when the virtual controller starts. If another process already owns that port, the bind fails, the controller reports that it could not set up the rule, and it stays offline. That is the reported 8443 case: with the standard settings, only one ctrlX COREvirtual in port-forwarding mode can run at a time, because the first instance owns 8443. Entering 5432:5432 trips the same mechanism — PostgreSQL itself is already listening on the Windows port, so the virtual controller cannot claim it.
The decision follows directly:
- For Node-RED to PostgreSQL, delete the database rule entirely; the guest-to-host direction needs no forwarding entry.
- For a second virtual controller, stop the first, or give one instance different Windows-side ports in its forwarding entries while keeping the controller-side values.
- Do not keep editing the flow while the controller is offline — the guest then has no network at all. Get a clean boot with the forwarding list you intend to keep, and only then test the flow.
Verify the route end to end #
- On Windows, confirm the listener: run
netstat -ano | findstr :5432and expect a LISTENING line, then run one query from any database client on the PC itself. - Boot the virtual controller with no database rule in the forwarding list and confirm it reaches its online state.
- In the PostgreSQL node, set the host to the guest-to-host alias and the port to the database port. Store the login in the node's credential store, and scope that database account to the one database and the operations the flow performs.
- Deploy a minimal flow — inject node, PostgreSQL node running
SELECT 1, debug node — and look for the returned row in the debug panel. A successful deploy proves nothing; a returned row proves the route. - If the flow writes, read the changed record back and check its value and timestamp before trusting the path in production.
- If the refusal comes back, recheck the host field first; if the node times out instead, work the hops in order — controller online, listener running, alias in the host field.
The decision, case by case #
- Node pointed at loopback inside ctrlX COREvirtual: the destination is one machine too early. Set the host to the guest-to-host alias, keep the database port, and treat query rows in the debug panel as the pass mark.
- Forwarding entry for the database: not needed, and not possible while PostgreSQL owns the Windows port. Entries serve host-to-controller traffic only.
- Boot failure naming a rule: the named Windows-side port belongs to another process — another virtual controller instance for 8443, PostgreSQL itself for the database port. Free the port or change the Windows-side value, then boot before touching the flow again.
Questions asked
Does the guest-to-host address change if the Windows PC has several network cards?
No. The alias belongs to the virtual network QEMU builds for the guest, not to any physical adapter, so it is the same regardless of how many network cards the PC has or which addresses they carry. The controller itself receives its address by DHCP from the range whose first address is 10.0.2.15. Start the virtual controller and the mapping is there; nothing in the host LAN setup changes it.
Does the alias work for other databases and services on the same PC?
Yes. The alias covers every port the Windows side actually listens on, so a MySQL, InfluxDB or MQTT broker on the same PC is reached the same way: the alias in the host field and each service's own port in the port field. Check each service's listening port first, because the alias changes the machine, not the port.
Do I need a Windows Firewall exception for the guest's database connection?
Normally no. The virtual network stack hands the guest's connection to the host's own loopback path, so Windows sees local traffic to the database port rather than inbound traffic from another device. That is why no firewall exception is needed for the query path to work. Keep the PostgreSQL login scoped to the database and the operations the flow actually performs.
What if the connection now succeeds but PostgreSQL rejects the login?
A different error appears. The refusal is a TCP-level answer that arrives before any credentials are sent; an authentication problem comes back as a PostgreSQL error naming the role or the password method. If you see a PostgreSQL error instead of the refusal, the route through the guest-to-host alias already works, and the fix belongs in the database account, not in the node's address or any forwarding entry.
Can two virtual controllers run in port-forwarding mode at the same time?
Not with the standard port settings. The first controller binds the Windows-side ports, and the second fails at startup saying the port is already in use. Stop the first controller before starting the second, or give one instance different Windows-side ports in its forwarding entries while keeping the controller-side values, so both can run at once.


