plan intermittently fails with "no version found matching 17.5.0" — embedded PostgreSQL binary unavailable offline
Description
pgschema plan intermittently fails to start its embedded PostgreSQL and aborts with: Error: failed to start embedded PostgreSQL: failed to start embedded PostgreSQL: no version found matching 17.5.0
The connection to the target database succeeds; the failure is solely in starting the embedded PostgreSQL that pgschema uses to materialize the desired state. This occurs in an offline/air-gapped container where the embedded-postgres binary for the exact pinned version (17.5.0) is not present and cannot be downloaded.
Notably, this is intermittent: using the same container image (pgschema 1.13.0, with PostgreSQL 17.10 and 14.24 installed), plan succeeds sometimes and fails other times. The environment (image, installed PG versions, target DB reachability) is identical across runs, yet the embedded PostgreSQL startup fails only on some runs — suggesting a flaky/non-deterministic path in how the embedded PostgreSQL binary version 17.5.0 is resolved/started.
Version
pgschema 1.13.0@a73db805 linux/amd64 2026-09-07 15:18:06
Environment
- Offline/air-gapped container (no outbound network to fetch embedded-postgres binaries).
- Locally installed PostgreSQL server binaries, managed via update-alternatives: /usr/lib/postgresql17/bin/postgres --version → postgres (PostgreSQL) 17.10 /usr/lib/postgresql14/bin/postgres --version → postgres (PostgreSQL) 14.24
- The locally installed PostgreSQL is 17.10, whereas the embedded PostgreSQL pgschema attempts to start is pinned to 17.5.0, which is not available.
Command
pgschema plan --debug --port 5432 --db db_myServer --user mmsuper --schema mmsuper
--file /var/opt/DB/db_myServer/data17/temp_upgrade/.pgschema_input.sql
--output-sql /var/opt/DB/db_myServer/data17/temp_upgrade/delta_ddl.sql
--output-human stdout
Debug output (failing run)
level=DEBUG msg="Attempting database connection" host=localhost port=5432 database=db_myServer user=mmsuper sslmode=prefer level=DEBUG msg="Database connection established successfully" Error: failed to start embedded PostgreSQL: failed to start embedded PostgreSQL: no version found matching 17.5.0
Expected behavior
In an offline environment, and given the intermittent nature, pgschema plan should reliably build the desired state without depending on a downloadable embedded PostgreSQL binary of one specific pinned patch version. For example:
- Use the locally installed PostgreSQL of a compatible major version (17.x already present at /usr/lib/postgresql17) rather than requiring exactly 17.5.0.
- Make the embedded PostgreSQL version configurable / match it to the installed server version.
- Bundle or allow an offline cache path for the embedded PostgreSQL binary.
- At minimum, behave deterministically and fail with a clear, actionable message (which version is needed, where to place it).
Actual behavior
plan intermittently aborts with no version found matching 17.5.0 and a non-zero exit code, even though a compatible local PostgreSQL 17.10 server is installed and the target database is reachable — and even though the same image succeeds on other runs.
Workaround (not viable for production)
--plan-host/--plan-db can point pgschema at the locally running PostgreSQL, avoiding the embedded PostgreSQL. However, this is not practical for production: it requires provisioning and cleaning up a dedicated, empty plan database on every run (a stale/existing plan database causes failures such as schema "..." already exists because the desired schema.sql includes CREATE SCHEMA), and it needs additional DB privileges and SSL-mode handling. We are looking for the embedded path to work reliably offline rather than relying on this.
Upstream issue
https://github.com/fergusstrange/embedded-postgres/blob/490777eebf4d3fe8615496cd4fc8430f5b93379d/remote_fetch.go#L42