When launching Spire Desktop, you may encounter the error:

"Unable to connect to the database engine. Please verify that the PostgreSQL service is running and accessible to this machine."

This article explains the meaning of this error, the common causes, and the solutions to resolve it.


What This Error Means

This error indicates that Spire Desktop cannot connect to the PostgreSQL service running on the Spire Server computer.

The issue may be caused by the PostgreSQL service not running, the workstation being on a different or restricted network, or a configuration issue preventing communication between the workstation and the server.


Things to Check

  1. Confirm that the spire-postgresql-14 (or 10) Windows service is running on the Spire Server.
  2. Verify that the network profile of the server is set to Private or Domain.
  3. Check whether the issue occurs for all users on the network or only specific ones.
  4. Ensure that Spire firewall rules are properly configured on the Spire Server.

Note:

  • On local networks or VPNs, Spire uses port 5432.
  • On Spire Cloud, communication happens on port 5433.
  • If Windows Firewall or a security appliance is blocking these ports, the workstation will not be able to connect.

Common Causes and Solutions

Cause: Workstation not on the same network as the Spire Server

Solution: Refer to the KB article Allowing Connections to Spire with VPN, RDP, and/or Multiple Networks.


Cause: Misconfigured pg_hba.conf file

Solution: Verify the file at:
C:\ProgramData\Spire\PostgreSQL\14 (or 10).
Ensure the entries include:

host   all   +spireuser   samenet        md5 host   all   +spireuser   fe80::/64      md5

Revert to default settings if misconfigured.


Cause: Spire is using a non-default port number

Solution:

  • Check spired.ini to confirm the configured port number.
  • Ensure pg_hba.conf matches this configuration and has not been edited incorrectly.

Cause: Anti-virus software blocking postgres.exe

Solution: Add postgres.exe as an exception in the anti-virus software.


Cause: Missing or incorrect "+spireuser" entry in pg_hba.conf

Solution: Update the pg_hba.conf file to include +spireuser.


Cause: Permission issues with C:\ProgramData\Spire

Solution: Grant Full Control permissions to the Local Server for this folder.


Cause: Password mismatch for "postgres" or "spireapp" users (ODBC/API connections)

Solution: Reset the password for the affected user account.


Cause: Incorrect Windows Firewall inbound rules

Solution: Verify that the inbound rule for Spire PostgreSQL points to the correct postgres.exe location.


Cause: PostgreSQL manually installed (firewall rules missing)

Solution: Manually add inbound rules for PostgreSQL to allow connections.


Cause: Outbound port 5433 blocked when using Spire Cloud

Solution:

  • Contact IT to confirm that outbound port 5433 is open.
  • For users outside North America, verify that AWS connections are permitted in your country.

Cause: Security appliances blocking traffic

Solution: If using devices like SonicWall, pfSense, or Fortinet, configure them to allow outbound traffic on port 5433.


Cause: Issue affects only a single user

Solution: Create a new Spire user to replace the problematic one.


Summary

If you see the "Unable to connect to the database engine" message:

  • First, confirm the PostgreSQL service is running.
  • Check network, firewall, and configuration settings.
  • Review pg_hba.conf and spired.ini files.
  • Verify that security tools and firewall rules allow connections on the correct port (5432 or 5433).

For additional guidance, see the related KB article on VPN and multiple network connections.