Aptible Tunnel Fails on Windows with "cannot close fd before spawn"
I'm trying to create a PostgreSQL tunnel using Aptible CLI on Windows, but the tunnel does not come up.
When I run:
aptible db:tunnel reach-development-db-pg-v13 --type postgresql
the error cannot close fd before spawn
typically indicates that the Aptible CLI isn’t able to execute a required command locally. This can happen due to issues like a misconfigured $PATH or, more commonly, interference from security software or system restrictions.
For example, we’ve seen cases where the embedded binary C:\aptible-toolbelt\embedded\bin\ssh-keygen
is blocked by antivirus or endpoint protection tools, which prevents the tunnel from coming up.
If you’re unable to resolve it by adjusting your security settings or confirming the binary can run, a common workaround is to install the Ubuntu version of the Aptible CLI on WSL (Windows Subsystem for Linux). This generally avoids the error above.