Skip to content
Latchkey

Pact provider version/branch not set breaking selectors in CI

The provider version and branch anchor several broker features: publishing verification results, computing pending status, and resolving matchingBranch selectors. When they are unset, results are not attributable and branch-aware selection breaks.

What this error means

Verification runs but warns that provider version or branch is missing, results are not published, or matchingBranch selectors return no consumer pacts.

Pact
WARN: providerVersion is not set; verification results will not be published.
WARN: providerVersionBranch is not set; pending and matchingBranch selection disabled.

Common causes

Provider version or branch env vars are empty

The verifier options read from empty variables, so the broker has no version or branch to attribute results to.

Detached HEAD hides the branch name in CI

A checkout in detached HEAD makes rev-parse --abbrev-ref HEAD return "HEAD", so the branch is effectively unset.

How to fix it

Set version and branch explicitly

  1. Pass providerVersion from the commit sha.
  2. Pass providerVersionBranch from the CI-provided branch name.
  3. Avoid relying on rev-parse under detached HEAD.
provider.verify.js
new Verifier({
  provider: 'orders-provider',
  providerVersion: process.env.GITHUB_SHA,
  providerVersionBranch: process.env.GITHUB_REF_NAME,
  publishVerificationResult: true,
})

Resolve the branch under detached HEAD

Use the CI-provided ref name rather than git, which reports "HEAD" on a detached checkout.

.github/workflows/ci.yml
env:
  GIT_BRANCH: ${{ github.head_ref || github.ref_name }}

How to prevent it

  • Always set provider version and branch from CI-provided variables.
  • Do not derive the branch from git under detached HEAD.
  • Publish verification results with a real provider version.

Frequently asked questions

What causes "Missing provider version/branch"?
The verifier options read from empty variables, so the broker has no version or branch to attribute results to.
How do I fix Missing provider version/branch?
Set version and branch explicitly

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card