Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during deployment of genAiPromptTemplate metadata to Scratch Org #3198

Closed
Eliott-Mischler opened this issue Jan 29, 2025 · 6 comments
Closed
Labels
more information required Issue requires more information or a response from the customer

Comments

@Eliott-Mischler
Copy link

Expected result

Pushing a genAiPromptTemplate retrieved from a Sandbox Org into a Scratch Org deploys successfully and causes no errors.

Actual result

The deployment to a Scratch Org fails with the following error : force-app\main\default\genAiPromptTemplates\Profil_Consommateur_Case.genAiPromptTemplate-meta.xml Error parsing file: 'DYW2v9UcOjEUClCiohijaAqJsFnmRY0EcHEQpp0ghTg=_1' is not a valid value for the type xsd:int (3:82)

Additional information

When creating a Scratch Org to push metadata that was retrieved from a Sandbox Org, an XML difference in the metadata definition of the genAiPromptTemplate object between Sandbox & Scratch Org causes an error to occur.
Recently, the XML for the genAiPromptTemplate object changed, with a hash now being contained in the versionIdentifier and activeVersion tags. Previously, versionIdentifier was versionNumber with an integer value.

The Prompt Template XML is as follows :

<?xml version="1.0" encoding="UTF-8"?>
<GenAiPromptTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
    <activeVersion>DYW2v9UcOjEUClCiohijaAqJsFnmRY0EcHEQpp0ghTg=_1</activeVersion>
    <createdInVersion>63.0</createdInVersion>
    <developerName>Profil_Consommateur_Case</developerName>
    <masterLabel>Profil Consommateur Case</masterLabel>
    <relatedEntity>Case</relatedEntity>
    <templateVersions>
        <content>Instructions : 
&quot;&quot;&quot;
Your role is to create a consumer profile based on the aggregated data from the prior conversations with said customer.
From the data, you will extract the following key points, explained in a concise (aim for a little under the length of a tweet per section) and clear manner :
1. Products of interest : Here you will list the categories of products the user has mentioned, while listing each individual product per category as well. Double-check that you didn&apos;t accidentally list the same product twice, and make sure you list every product you picked up. Empty categories or repetition are to be avoided at all costs, keep it clear and to the point. If the client is interested in free products / samples, mention it here as well.
2. Recurring feedback : Here, you will summarize the common pain points and topics around which the user&apos;s questions or feedback revolve. You may mention the product again, but the point of this section is rather &quot;what about these products concerns the consumer?&quot;.
3. Possible health implications : Here, you will suggest, based on the age and the content of the conversations, whether the consumer is likely to have a health complication. Do not hesitate to admit if you don&apos;t have enough to go off of in this one, and only make a suggestion if you feel justified in it.
4. Consumer tone : Here, you are tasked with gauging what the user is looking for, and whether they have specific, noteworthy temperaments or tones that persisted throughout previous interactions. If they have been respectful, no need to specify, simply do so if you feel the consumer has a slightly odd or abnormal tone, expression, or expectation (such as writing excessive emails asking for free products, a prevailing sense of authority when speaking, etc.)


This list will be prefaced by &quot;Profil du Consommateur [Consumer Name], [Consumer age] ans&quot;. Skip the age description if it is not given.
&quot;&quot;&quot;

Data :
&quot;&quot;&quot;
{!$Flow:ProfilConsommateurEinstein.Prompt}
&quot;&quot;&quot;
</content>
        <inputs>
            <apiName>objectToSummarize</apiName>
            <definition>SOBJECT://Case</definition>
            <referenceName>Input:Case</referenceName>
            <required>true</required>
        </inputs>
        <primaryModel>sfdc_ai__DefaultGPT4Omni</primaryModel>
        <status>Published</status>
        <templateDataProviders>
            <definition>flow://ProfilConsommateurEinstein</definition>
            <parameters>
                <definition>SOBJECT://Case</definition>
                <isRequired>true</isRequired>
                <parameterName>objectToSummarize</parameterName>
                <valueExpression>{!$Input:Case}</valueExpression>
            </parameters>
            <referenceName>Flow:ProfilConsommateurEinstein</referenceName>
        </templateDataProviders>
        <versionIdentifier>DYW2v9UcOjEUClCiohijaAqJsFnmRY0EcHEQpp0ghTg=_1</versionIdentifier>
    </templateVersions>
    <type>einstein_gpt__recordSummary</type>
    <visibility>Global</visibility>
</GenAiPromptTemplate>

System Information

CLI:
@salesforce/cli/2.73.9 win32-x64 node-v22.12.0

Plugin Version:
@oclif/plugin-autocomplete 3.2.17 (core)
@oclif/plugin-commands 4.1.16 (core)
@oclif/plugin-help 6.2.21 (core)
@oclif/plugin-not-found 3.2.35 (core)
@oclif/plugin-plugins 5.4.25 (core)
@oclif/plugin-search 1.2.18 (core)
@oclif/plugin-update 4.6.23 (core)
@oclif/plugin-version 2.2.20 (core)
@oclif/plugin-warn-if-update-available 3.1.30 (core)
@oclif/plugin-which 3.2.25 (core)
@salesforce/cli 2.73.9 (core)
apex 3.6.8 (core)
api 1.3.3 (core)
auth 3.6.87 (core)
data 4.0.1 (core)
deploy-retrieve 3.17.7 (core)
info 3.4.32 (core)
limits 3.3.44 (core)
marketplace 1.3.7 (core)
org 5.2.23 (core)
packaging 2.9.12 (core)
schema 3.3.46 (core)
settings 2.4.10 (core)
sobject 1.4.49 (core)
telemetry 3.6.29 (core)
templates 56.3.35 (core)
trust 3.7.55 (core)
user 3.6.6 (core)
SF ENV. VARS.
SF_AUTOUPDATE_DISABLE,true
SF_BINPATH,C:\Users\Gaask\AppData\Local\sf\client\bin\sf
SF_DISABLE_AUTOUPDATE,true
SF_UPDATE_INSTRUCTIONS,Use "npm update --global @salesforce/cli" to update npm-based installations.
Windows: true
Shell: powershell
Channel: stable

Diagnostics

✅ pass - salesforcedx plugin isn’t installed
✅ pass - you don't have any linked plugins
✅ pass - [@salesforce/plugin-trust] can ping: https://registry.npmjs.org
✅ pass - [@salesforce/plugin-trust] can ping: https://registry.yarnpkg.com
✅ pass - [@salesforce/plugin-trust] can ping: https://registry.npmjs.org/
✅ pass - using latest or latest-rc CLI version
✅ pass - can access: https://test.salesforce.com
✅ pass - [@salesforce/plugin-deploy-retrieve] sourceApiVersion matches apiVersion
❌ warn - [@salesforce/plugin-deploy-retrieve] default target DevHub max apiVersion matches default target org max apiVersion
❌ warn - [@salesforce/plugin-deploy-retrieve] sourceApiVersion matches default target org max apiVersion
✅ pass - can access: https://appexchange.salesforce.com/services/data
✅ pass - can access: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64-buildmanifest
✅ pass - [@salesforce/plugin-auth] CLI supports v2 crypto
✅ pass - [@salesforce/plugin-auth] CLI using stable v1 crypto

@WillieRuemmele
Copy link
Member

WillieRuemmele commented Jan 29, 2025

Hi @Eliott-Mischler -

can you run the deploy command with --dev-debug and provide the stack trace?

just so I'm understanding, the activeVersion field used to be a number, but now, when you retrieve it, it's this hash? does this happen when retrieving in metadata format?

I've reached out to the metadata owning team to see what's going on, this doesn't match what's documented in their metadata documentation

@WillieRuemmele WillieRuemmele added the waiting for internal reply The Salesforce team is working on a fix and has promised an update label Jan 31, 2025
@Eliott-Mischler
Copy link
Author

Hello @WillieRuemmele,

Just so I'm understanding, the activeVersion field used to be a number, but now, when you retrieve it, it's this hash? does this happen when retrieving in metadata format?

Almost ! activeVersion and versionIdentifier did not previously exist in our metadata, whereas now they do, containing a hash. Previously, the only versioning-related tag was versionNumber, which contained an integer. However you are right, the activeVersion and versionIdentifier tags currently contain hashes when retrieved from a Sandbox Org.

Here is the --dev-debug stack trace for the deployment:

[19:53:46.377] DEBUG (sf:oclif:MetadataApiDeploy): MDAPI status update: Failed
[19:53:46.379] DEBUG (sf:oclif:SourceTracking): received scopedPostDeploy event
[19:53:46.809] TRACE (sf:oclif:perf): Created 'sf:oclif:perf' child logger instance
[19:53:46.809] DEBUG (sf:oclif:perf): Process Uptime: 197525.3529ms
[19:53:46.809] DEBUG (sf:oclif:perf): Oclif Time: 197048.4557ms
[19:53:46.809] DEBUG (sf:oclif:perf): Init Time: 220.3782ms
[19:53:46.809] DEBUG (sf:oclif:perf): Config Load Time: 13.2730ms
[19:53:46.809] DEBUG (sf:oclif:perf):   ΓÇó Root Plugin Load Time: 14.8544ms
[19:53:46.809] DEBUG (sf:oclif:perf):   ΓÇó Plugins Load Time: 0.0888ms
[19:53:46.809] DEBUG (sf:oclif:perf):   ΓÇó Commands Load Time: 10.4771ms
[19:53:46.809] DEBUG (sf:oclif:perf): Core Plugin Load Time: 37.1756ms
[19:53:46.809] DEBUG (sf:oclif:perf): User Plugin Load Time: 7.4396ms
[19:53:46.809] DEBUG (sf:oclif:perf): Linked Plugin Load Time: 0.0000ms
[19:53:46.809] DEBUG (sf:oclif:perf): Plugin Load Times:
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-autocomplete: 31.1841ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-commands: 30.4817ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-help: 29.3398ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-not-found: 28.3211ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-plugins: 28.2112ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-search: 27.8780ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-update: 27.2200ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-version: 25.3583ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-warn-if-update-available: 25.2511ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @oclif/plugin-which: 24.4625ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-apex: 24.0822ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-data: 23.0284ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-api: 22.9593ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-auth: 22.4887ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-deploy-retrieve: 21.5757ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-packaging: 20.2339ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-info: 19.9323ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-org: 19.5951ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-limits: 19.2733ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-marketplace: 18.3880ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-schema: 17.4553ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-settings: 17.4084ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-sobject: 16.0360ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-templates: 15.3532ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-telemetry: 15.1252ms
[19:53:46.809] DEBUG (sf:oclif:perf):   root: 14.8544ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-trust: 14.0530ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/plugin-user: 13.9881ms
[19:53:46.809] DEBUG (sf:oclif:perf):   @salesforce/sfdx-scanner: 7.1237ms
[19:53:46.809] DEBUG (sf:oclif:perf):     total: 405.7061ms
[19:53:46.809] DEBUG (sf:oclif:perf):     @salesforce/cli(./dist/hooks/prerun): 4.5447ms
[19:53:46.809] DEBUG (sf:oclif:perf):     @salesforce/plugin-telemetry(./lib/hooks/telemetryPrerun.js): 405.5942ms
[19:53:46.809] DEBUG (sf:oclif:perf): Command Load Time: 0.0000ms
[19:53:46.809] DEBUG (sf:oclif:perf): Command Run Time: 196828.0974ms
[19:53:46.809] DEBUG (sf:oclif:config): start finally hook
[19:53:46.809] DEBUG (sf:oclif:config): finally hook done
[19:53:46.810] ERROR (sf:oclif): FailedValidationError: Failed to validate the deployment (0AfAa00000ffWM8KAM). Due To:
Error in Profil_Consommateur_Einstein_ScreenFlow - Appel_Profil_Consommateur_Case (Action) - We can't find an action with the name and action type that you specified.[19:53:46.809] DEBUG (sf:oclif:perf):     total: 405.7061ms
[19:53:46.809] DEBUG (sf:oclif:perf):     @salesforce/cli(./dist/hooks/prerun): 4.5447ms
[19:53:46.809] DEBUG (sf:oclif:perf):     @salesforce/plugin-telemetry(./lib/hooks/telemetryPrerun.js): 405.5942ms
[19:53:46.809] DEBUG (sf:oclif:perf): Command Load Time: 0.0000ms
[19:53:46.809] DEBUG (sf:oclif:perf): Command Run Time: 196828.0974ms
[19:53:46.809] DEBUG (sf:oclif:config): start finally hook
[19:53:46.809] DEBUG (sf:oclif:config): finally hook done
[19:53:46.810] ERROR (sf:oclif): FailedValidationError: Failed to validate the deployment (0AfAa00000ffWM8KAM). Due To:
Error in Profil_Consommateur_Einstein_ScreenFlow - Appel_Profil_Consommateur_Case (Action) - We can't find an action with the name and action type that you specified. you specified.                                                                                                                                        2)
Error in Profil_Consommateur_Case - Error parsing file: 'DYW2v9UcOjEUClCiohijaAqJsFnmRY0EcHEQpp0ghTg=_1' is not a valid value for the type xsd:int (3:82)                                                                                                                                                     Error.js:39:16)
2 component error(s)                                                                                                                                   sfCommand.js:316:47)
    at SfCommandError.from (file:///C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/node_modules/@salesforce/sf-plugins-core/lib/SfCommand@oclif/core/lib/command.js:316:29)Error.js:39:16)
    at DeployMetadataValidate.catch (file:///C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/node_modules/@salesforce/sf-plugins-core/lib/sfCommand.js:316:47)
    at DeployMetadataValidate._run (C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/node_modules/@salesforce/sf-plugins-core/node_modules/@oclif/core/lib/command.js:316:29)                                                                                                                     ib\performance.js:218:15)
    at async Config.runCommand (C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/node_modules/@oclif/core/lib/config/config.js:435:25)     lemetryPrerun.js:72:41)
    at async run (C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/node_modules/@oclif/core/lib/main.js:96:16)
    at async file:///C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/bin/run.js:15:1
  sf:telemetry Unable to get oclif performance metrics Error: Perf results not available. Did you forget to call await Performance.collect()?
    at get oclifPerf (C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\node_modules\@salesforce\plugin-telemetry\node_modules\@oclif\core\lib\performance.js:218:15)
    at process.<anonymous> (file:///C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/node_modules/@salesforce/plugin-telemetry/lib/hooks/telemetryPrerun.js:72:41)
    at Object.onceWrapper (node:events:639:26)
    at process.emit (node:events:536:35)                                                                                                               -2338a5a\node_modules\@salesforce\plugin-telemetry\processe
    at process.processEmit [as emit] (C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\node_modules\signal-exit\index.js:191:37)           3c.log" +6ms
    at process.exit (node:internal/process/per_thread:182:15)
    at Object.exit (C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\node_modules\@oclif\core\lib\errors\handle.js:23:17)
    at handle (C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\node_modules\@oclif\core\lib\errors\handle.js:53:22)
    at C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\node_modules\@oclif\core\lib\execute.js:63:53
    at async file:///C:/Users/XXXXXXXXX/AppData/Local/sf/client/2.73.9-2338a5a/bin/run.js:15:1 +3m
  sf:telemetry Spawning "C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\bin\node.exe C:\Users\XXXXXXXXX\AppData\Local\sf\client\2.73.9-2338a5a\node_modules\@salesforce\plugin-telemetry\processes\upload.js C:\Users\XXXXXXXXX\AppData\Local\sf C:\Users\XXXXXXXXX\AppData\Local\Temp\sf-telemetry\telemetry-aac0ae45e4f73950ac48c180020c175d4218923c.log" +6ms

@WillieRuemmele
Copy link
Member

Hi @Eliott-Mischler - I just spoke to the metadata owning team, and they confirmed that this change is expected.

they also confirmed that the docs here are wrong 😦 and that the type is no longer an int

are your "source" (where you're retrieving from) and "target" (where deploying to) org on the same api versions? if the "source" is ahead you can retrieve in the correct format by adding the --api-version flag

@WillieRuemmele WillieRuemmele added more information required Issue requires more information or a response from the customer and removed waiting for internal reply The Salesforce team is working on a fix and has promised an update labels Feb 4, 2025
@Eliott-Mischler
Copy link
Author

Hi @WillieRuemmele ,

Your last comment put us on the right track ! Our issue was ultimately something quite similar to what you've mentioned in the above reply. However, the --api-version flag during retrieval did not resolve it immediately. The fact of the matter was that the Sandbox Org the metadata was retrieved from was in Salesforce Spring '25, and our pipelines create a Scratch Org based on the Org Shape of our production Org, which is in Winter '25.
So we did indeed get an XML parsing error due to a version mismatch. We were able to test this solution by manually deploying the metadata to a Spring '25 Scratch Org. So, moving forwards our solution will be to wait until our production environment is in Spring '25, which will align the Salesforce version across our environments.
Closing this issue as it is effectively resolved. Thanks for the help !

Copy link

github-actions bot commented Feb 5, 2025

Hello @Eliott-Mischler 👋 None of the versions of sf you shared match the latest release.

Shared: 2.73.9
Latest: 2.74.6

Update to the latest version of Salesforce CLI (docs) and confirm that you're still seeing your issue.
You can also try the rc and nightly releases! (docs)

After updating, share the full output of sf version --verbose --json

@WillieRuemmele
Copy link
Member

@Eliott-Mischler - glad to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more information required Issue requires more information or a response from the customer
Projects
None yet
Development

No branches or pull requests

2 participants