Explanation of the error
Salesforce returns this error when you deploy an Agentforce agent that isn't in a draft state together with the components Salesforce generated for it. You can hit it when Gearset validates or deploys the agent to a Salesforce org, including a Pipelines promotion.
When you commit an Agent Script in Agentforce Builder, Salesforce generates the metadata the agent needs to run:
A versioned snapshot of the
AiAuthoringBundleAn Einstein Bot (
Bot)A Bot Version (
BotVersion)A Planner bundle (
GenAiPlannerBundle)
Salesforce doesn't generally support deploying an Agent Script in the committed state, and a committed agent can't be edited. Deploying the committed agent with its generated Bot, BotVersion, and GenAiPlannerBundle asks Salesforce to change a bot it won't let you change, and the deployment fails with this error.
To check whether the agent you're deploying is a draft, look at its AiAuthoringBundle. A <target> element means the agent isn't a draft.
Resolution
Deploy the Agent Script as a draft, and leave the Bot, BotVersion, and GenAiPlannerBundle out of the deployment.
Gearset does this for you. When the Agent Script version you selected is committed, the Problem Analyzer flags it under Deploy Agent script as a draft and explains:
Salesforce does not generally support deploying an Agent script in the committed state.
Removing the target tag from the Agent script metadata allows it to be deployed as a draft instead. The linked Bot, Bot version and Planner bundle will also be excluded from the deployment.
The Problem Analyzer runs whenever the version you selected is committed, whatever state the Agent Script is in on the target, including when it isn't there at all. It runs for Salesforce org targets and for source control targets, and it makes the change for you, so you don't need to edit the metadata by hand.
Salesforce regenerates the Bot, BotVersion, and GenAiPlannerBundle when the draft is committed in the target org. Turn on the Commit Agent Script after deployment post-deployment step to have Gearset commit the draft in the target as soon as the deployment finishes.
If your agent is a service agent
A service agent has a user assigned to it, set as default_agent_user in the Agent Script. Salesforce won't let that user change once the agent has been committed, so the user in your source has to match the one already in the target before the agent can be committed there. A second Problem Analyzer handles this:
If the agent already exists in the target and the users differ, Gearset flags
Modified Agent script files specify a different user than the targetand offers to replace thedefault_agent_uservalue with the user set in the target. This fix isn't selected by default, so tick it before you continue.If the agent is new in the target, Gearset warns under
New Agent script files reference users that might not exist in the target. There's no fix to apply: after the deployment, commit the agent manually in the target org, which lets you set the user. Later deployments of that agent can then use the fix above.
For more on Agent Script versions and states, read How to Deploy Agent Script (AiAuthoringBundle) metadata and How to deploy Agentforce Agents.
Disclaimer: This error is returned directly by Salesforce, 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.
If this doesn't change anything, please send a message to our support team, who will be happy to help.



