Pact Go verifier provider mismatch / setup error in CI
pact-go drives verification through the shared FFI library and reports failures from VerifyProvider. Failures are either genuine interaction mismatches or setup problems: a missing libpact_ffi shared library or a provider base URL that is not reachable.
What this error means
A Go test fails with "the verification process failed" from VerifyProvider, or the binary cannot load libpact_ffi, so verification never runs.
--- FAIL: TestProvider (0.42s)
verifier.go: the verification process failed, see output for details
error while loading shared libraries: libpact_ffi.so: cannot open shared object fileCommon causes
The Pact FFI shared library is not installed
pact-go needs the libpact_ffi library available at the expected version; a missing or mismatched library stops verification before it starts.
Interaction mismatch or unreachable provider
The provider response did not match a pact, or ProviderBaseURL pointed at a provider that was not running.
How to fix it
Install the matching FFI library
- Run
pact-goinstaller to fetch the FFI library version the client expects. - Confirm the library is on the loader path.
- Re-run verification.
go install github.com/pact-foundation/pact-go/v2@latest
pact-go -l DEBUG installPoint at a running provider and set state handlers
Set ProviderBaseURL to the booted app and register StateHandlers for each provider state.
verifier.VerifyProvider(t, provider.VerifyRequest{
ProviderBaseURL: "http://localhost:8080",
StateHandlers: handlers,
})How to prevent it
- Install the pact-go FFI library as a setup step in CI.
- Health-check the provider before VerifyProvider runs.
- Register state handlers for every provider state.