Error overview
When deploying a GenAiPromptTemplate (in Gearset filters referenced as "Prompt Template" metadata) that is grounded with a data source, you may run into a validation error similar to:
Failure to create template: <id>, Caused by: [We couldn't validate the prompt template because something went wrong: Error while executing the following data provider: <data provider id>, Error: <data provider id> is not accessible]
In this example <id> refers to the Prompt Template's ID, while <data provider id> refers to the Id of the Flow or Apex class grounding it.
If your Prompt Template is also called from a Flow as an action, you may see a related error on the Flow metadata (it may happen if that Flow is included in your deployment package):
field integrity exception: unknown {The "FlexTemplate://<Template_API_Name>" capabilityType specified in the flow metadata is invalid. Specify a valid capabilityType and try again.}
These two errors are usually two symptoms of the same underlying issue, rather than two separate problems.
Explanation of the error
A Prompt Template can be grounded with a data provider – usually a Flow or an Apex class – that supplies it with data at runtime.
Salesforce references that data provider internally by record Id (for example 300dt00000EOaa9), rather than by API name.
When Gearset validates or deploys the Prompt Template against the target org, Salesforce tries to resolve that data provider Id in the target org. If it can't, it returns the "<data provider id> is not accessible" error.
This is typically caused by one of the following reasons:
The Flow or Apex class backing the data provider hasn't been deployed to the target org yet, so there's nothing for the Id to resolve to.
The Salesforce user making a deployment to the target org doesn’t have permission to see the referenced Flow or Apex class – this is commonly resolved by assigning the "Prompt Template Manager" permission set to that Salesforce user.
The comparison used for the deployment in Gearset is running on an API version lower than 60, which
GenAiPromptTemplatemetadata requires.
Because the Prompt Template never gets created in the target org, any Flow that calls it as an action (via FlexTemplate://<Template_API_Name>) has nothing valid to resolve that reference against.
Salesforce then reports the Flow's action reference as an invalid capabilityType. We believe it can be a knock-on failure where resolving the Prompt Template error first should clear the Flow error automatically, without needing a separate fix.
Resolution
Before you start applying a fix, make sure that:
Your comparison used for the deployment (or the CI job deploying changes to the target org) is configured to run on API version 60 or higher – earlier versions don't support GenAiPromptTemplate metadata.
Salesforce user used for running this deployment has the "Prompt Template Manager" permission set assigned in the target org.
Once the above is verified, you can follow below steps:
1. Identify the data provider
In the source org, open the Prompt Template in Prompt Builder.
Check what's configured under its grounding (data source).
Identify the Flow or Apex class backing the data provider Id named in the error.
2. Deploy the missing dependency alongside the Prompt Template
Add that Flow or Apex class to the same deployment package as the Prompt Template.
If you're pushing your changes via a PR in Gearset Pipelines, you'd normally use "Commit more changes" option to add the missing Flow/Apex class into the feature branch from which PR was opened.
Re-run the deployment, or re-validate the PR opened in your Pipeline.
3. If the above doesn't resolve it, deploy the dependency first
This works around a known Salesforce issue: deployments fail if a Prompt Template is linked to a Flow that contains an Apex action
(as per the reference in our article on how to deploy Agentforce Prompt Template).Deploy the Flow/Apex class to the target org on its own as a separate deployment (e.g. in the Gearset Pipeline consider creating a new feature).
Once the Flow/Apex class is deployed to the target org, follow up with a deployment of the Prompt Template.
4. Re-validate the Flow
Once the Prompt Template is deployed successfully to the target org, re-run the validation on any Flow that references it via
FlexTemplate://.The
capabilityTypeerror should clear once the Prompt Template exists in the target org.
Alternative workaround
Note: This solution was applied by one of our users in order to fix the error surfaced on Prompt Template.
If you can't deploy the Flow or Apex dependency independently (for example, if it has further unresolved dependencies of its own), then one option is to get the Prompt Template created in the target org without its grounding configured.
Then deploy the full version of Prompt Template as part of a second deployment.
Create a deployment package containing only the Prompt Template metadata file.
Edit the
GenAiPromptTemplateXML directly (via Git) to remove the data provider/grounding references.Deploy this stripped-down version to the target org as a standalone deployment.
With no data provider reference, there's nothing for Salesforce to validate, so this should succeed and create the record in the target org.
Deploy your original change as normal: with the Prompt Template's full definition (grounding included).
Because the record now already exists in the target org, this is an update rather than a creation - which, in this case, shouldn't re-trigger the data provider validation.
This isn't documented Salesforce behavior, and it means working directly with raw metadata XML, so please treat it as a fallback if the steps above don't apply to your setup, since Salesforce could change this update-path behavior at any time.
Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.


