Error overview
When deploying CPQ (or Agentforce Revenue Management) configuration between Salesforce orgs, or via Gearset Pipeline, you may see a deployment failure following this error pattern:
INVALID_FIELD: Foreign key external ID: <value> not found for field GearsetExternalId__c in entity <ObjectName>:--
An example of the error in our app:
During External ID setup required prior to any new CPQ deployment, Gearset adds a custom field named GearsetExternalId__c to your CPQ objects.
Every record gets a unique value in this field and Gearset uses that value, rather than the Salesforce record ID, which changes every time a record is inserted into a new org - to recognise that a Product, Price Rule, or other CPQ record in your source org is "the same" record in your target org.
This error means Salesforce tried to match an incoming record to an existing record in your target org using its Gearset external ID, and couldn't find any record in <ObjectName> with that value.
You'll usually see it as a failed component in your deployment results, with the object name and the specific external ID value that couldn't be matched.
Explanation of the error
This error message covers several distinct underlying causes. In order of how often we typically see them:
A dependency the record relies on isn't in the deployment package or in the target org
The failing record refers to a parent or related record (for example, a Product Rule referencing its parent Product) that doesn't yet exist in the target org, and wasn't retrieved in the comparison and/or included in your deployment package. Gearset can't create the foreign key link because the record it points to isn't there to match against.
External IDs are out of sync between your orgs
This is common after a Sandbox refresh (which resets or blanks Gearset external ID values) - when CPQ records are created directly in an org outside Gearset, or in multi-environment pipelines where an intermediate org's IDs fall behind after a refresh further down the chain.
The external ID setup wizard hasn't been run on every object, or on every org
This may include newly added CPQ/ARM objects, junction objects, or newly used Sandboxes for deployments - e.g. orgs that were never included in an External wizard setup.
Less common: corrupted or legacy source data
A small number of very old records with broken internal references can cause an entire Bulk API batch to be rejected. This is a genuine edge case rather than a configuration issue, and usually needs the specific bad records identified and fixed (or escalated) individually.
Note: Because the field name in the error is GearsetExternalId__c, it's tempting to assume the fix is always to rerun the external ID wizard. In practice, cause 1 (a missing dependency) is the most frequent root cause, and re-running the wizard alone won't fix it - the dependent record genuinely isn't in the target org yet, and usally needs to be deployed to the target org first.
Resolution
Work through below steps in order. They're listed to help you identify the most common cause first.
Identify the record and object
Note the object name and external ID value from the error, and confirm whether this is an org-to-org deployment or a CI job deployment (e.g. in your Gearset Pipeline followed a successful PR merge). Confirm which org is the source and which is the target.
Check whether a dependency is missing from the deployment
Look at the failing record's relationships (for example, does a Product Rule or Product Option reference a parent Product?) and check whether that parent/related record is included in your comparison.
If it isn't, broaden your Revenue Cloud comparison filter to include the missing object type. Add the specific missing component to your deployment package, and retry the deployment. This resolves many of such cases.
Check for out-of-sync external IDs
This is especially likely after a recent sandbox refresh. If records were created directly in an org that belongs to your Gearset Pipeline, this org may be out of sync with other Pipeline environments.
Use the Data Deployment tool (legacy "Configure data deployment" option) to solve mismatches in Gearset external IDs, or the Gearset template for out-of-sync IDs to realign them.
Re-run the external ID setup wizard on both source and target orgs
This is safe and won't affect existing external IDs - it only populates missing external IDs. It can help if a new object was recently added to your CPQ configuration, or a sandbox org you're using as source/target of the deployment is newly connected and never had the wizard run against it.
For deployments made via Gearset Pipeline (CI jobs)
Check if there was a direct CPQ data change added in the target org. If so, ensure that the CPQ data change is committed back to the feature branch from which you're promoting your changes. Re-open the PR against the target environment it was promoted to.
Remember that a change made directly in the target Sandbox won't appear in any new pull request until it's committed back to the feature branch, and aligned with other Pipeline's Git environments (branches). Retrying the CI deployment alone won't pick up the change.
If the error persists after all of the above...
It may involve a small number of corrupted or very old legacy records with broken internal references, which can cause an entire batch to fail. Try isolating the specific failing records (for example, via a failures export if available) and get in touch with Gearset support - this scenario is rare and may need further guidance or consultation from our team.

