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 when trying to retrieve CustomObjectTranslation metadata: "Metadata API request failed: Component conversion failed: Unexpected child metadata ..." #1262

Closed
SCWells72 opened this issue Nov 1, 2021 · 18 comments
Labels
investigating We're actively investigating this issue

Comments

@SCWells72
Copy link

Hi, folks. I ran into this today while doing some testing against NPSP. Basically after successfully pushing the latest NPSP metadata into a scratch org, I tried to retrieve the org metadata for comparison in IC2. That action actually creates a temp dir into which the retrieved files should be placed, and a package.xml file that frames the metadata requested for retrieval, then runs sfdx force:source:retrieve -x /path/to/package.xml with the temp dir as the CLI process' working directory. That's only important because after some troubleshooting to characterize the issue, it seems that this problem specifically occurs when trying to retrieve CustomObjectTranslation metadata for a translation that includes child CustomFieldTranslation metadata when there's no existing local copy of the same. I was then able to reproduce this behavior without needing a temp directory by just removing the local copies of the files being retrieved.

Here's the command being executed and the specific error for reference:

$ sfdx force:source:retrieve -x package.xml -u scratch-org-alias
ERROR running force:source:retrieve:  Metadata API request failed: Component conversion failed: Unexpected child metadata [/path/to/projects/npsp/force-app/main/default/objectTranslations/Activity-ja/Engagement_Plan_Task__c.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

and the package.xml file being used for this retrieval is just:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Activity-ja</members>
        <name>CustomObjectTranslation</name>
    </types>
    <version>53.0</version>
</Package>

My guess is that you could reproduce this pretty easily against any org populated with CustomObjectTranslation/CustomFieldTranslation metadata without having to set up NPSP locally.

Oh, and this is all against the latest-and-greatest at the time I'm submitting this bug, sfdx-cli/7.124.0 win32-x64 node-v14.18.1.

Let me know if you need any other info to help reproduce this.

@SCWells72 SCWells72 added the investigating We're actively investigating this issue label Nov 1, 2021
@github-actions
Copy link

github-actions bot commented Nov 1, 2021

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@WillieRuemmele
Copy link
Member

That sounds like the same issue as this and is fixed in latest-rc: 7.125.0

@SCWells72
Copy link
Author

Sounds good. I'll take a look once it's in GA and verify that the issue is in fact fixed. When I encounter what seems to be a bug with CLI-based deployment/retrieval/etc.--and of course I've verified that it occurs in the latest-and-greatest--I always try to file issues here accordingly. Otherwise these things come back to haunt me when some IC2 user hits the same bug and, because IC2 provides a façade atop the CLI, I end up taking front-line support.

@MorganMarchese
Copy link

This issue is still happening for me today while on sfdx-cli/7.125.0. Cannot Retrieve, and for some reason cannot deploy (even when not deploying Custom Object Translations). I just tried to deploy a package.xml that contains only apex, with no references to translations, and it fails with

Unexpected child metadata [\force-app\main\default\objectTranslations\managedNamespace__Account_Tag_Segment_Trigger__c-en_US\managedNamespace__Account__c.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

I had to delete my entire objectTranslations folder in my local repo to get around this and deploy anything today.

@WillieRuemmele

@cristiand391
Copy link
Member

@MorganMarchese are you able to reproduce the issue with this repo on your machine?
I've just tried to repro it again with sfdx-cli/7.125.0 darwin-x64 node-v14.18.1 but I don't get the error anymore.

Also, can you run sfdx version --verbose --json and paste the output here?

@pmk-tyro
Copy link

pmk-tyro commented Nov 16, 2021

@cristiand391 - I get the same error below is the requested detail. I updated to latest cli too, still no luck.

{
"cliVersion": "sfdx-cli/7.127.0",
"architecture": "darwin-x64",
"nodeVersion": "node-v16.13.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 0.3.0 (core)",
"@oclif/plugin-commands 1.3.0 (core)",
"@oclif/plugin-help 3.2.3 (core)",
"@oclif/plugin-not-found 1.2.4 (core)",
"@oclif/plugin-plugins 1.10.1 (core)",
"@oclif/plugin-update 1.5.0 (core)",
"@oclif/plugin-warn-if-update-available 1.7.0 (core)",
"@oclif/plugin-which 1.0.3 (core)",
"@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
"alias 1.1.22 (core)",
"apex 0.3.0 (core)",
"auth 1.7.5 (core)",
"config 1.2.47 (core)",
"custom-metadata 1.0.12 (core)",
"data 0.6.4 (core)",
"generator 1.2.1 (core)",
"limits 1.2.3 (core)",
"mo-dx-plugin 0.3.2",
"org 1.9.0 (core)",
"salesforce-alm 53.4.2 (core)",
"schema 1.0.10 (core)",
"sfdx-cli 7.127.0 (core)",
"source 1.4.0 (core)",
"telemetry 1.2.8 (core)",
"templates 52.6.0 (core)",
"trust 1.0.10 (core)",
"user 1.5.2 (core)"
],
"osVersion": "Darwin 20.6.0"
}

@mgrygielSii
Copy link

WORKAROUND: Just create a OBJECT_NAME.objectTranslation-meta.xml in the folder that is causing problem.

Example:
Starting SFDX: Retrieve Source from Org
Unexpected child metadata [\force-app\main\default\objectTranslations\Opportunity-en_US\amount_opportunity.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

The current folder structure:
/objectTranslations
--/Opportunity-en_US
----/amount_opportunity.fieldTranslation-meta.xml

A desired folder structure:
/objectTranslations
--/Opportunity-en_US
----/amount_opportunity.fieldTranslation-meta.xml
----/Opportunity-en_US.objectTranslation-meta.xml <- create this file with basic XML

After creating the main obj Translation file, SFDX behaves as expected.

Hope somebody will benefit from this.
Thx, Marek.

@shetzel
Copy link
Contributor

shetzel commented Nov 23, 2021

I am not able to reproduce this. Here are the steps I'm using.

  1. sfdx force:project:create -n Issue1262
  2. cd Issue1262
  3. sfdx force:org:create -f config/project-scratch-def.json -a issue1262 -s
  4. sfdx force:org:open
  5. create a new field on the Opportunity object called "advent"
  6. enable translations
  7. add english and spanish languages
  8. create an english and spanish translation for the advent field on the Opportunity object
  9. sfdx force:source:retrieve -m CustomObjectTranslation:Opportunity-es

Result: CustomFieldTranslation retrieved to force-app/main/default/objectTranslations/Opportunity-es/advent__c.fieldTranslation-meta.xml

Also tried:
sfdx force:source:retrieve -m CustomObjectTranslation
sfdx force:source:retrieve -x package.xml where the package.xml only had the Opportunity-es CustomObjectTranslation defined.

@SCWells72 - are you able to reproduce this anymore?

@JavierCarvajalLBS
Copy link

JavierCarvajalLBS commented Nov 29, 2021

@shetzel I´m still having the same issue today:

Metadata API request failed: Component conversion failed: Unexpected child metadata [\force-app\main\default\objectTranslations\efl__EFL_Child_Objects_List__c-en_US\efl__Object_Name__c.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

I´m using a package.xml with all the CustomObject included and using the wildcard * in the CustomObjectTranslation component (I need to retrieve all the components in the org).

And it is my system configuration:
{
"cliVersion": "sfdx-cli/7.127.0",
"architecture": "win32-x64",
"nodeVersion": "node-v16.13.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 0.3.0 (core)",
"@oclif/plugin-commands 1.3.0 (core)",
"@oclif/plugin-help 3.2.3 (core)",
"@oclif/plugin-not-found 1.2.4 (core)",
"@oclif/plugin-plugins 1.10.1 (core)",
"@oclif/plugin-update 1.5.0 (core)",
"@oclif/plugin-warn-if-update-available 1.7.0 (core)",
"@oclif/plugin-which 1.0.3 (core)",
"@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
"alias 1.1.22 (core)",
"apex 0.3.0 (core)",
"auth 1.7.5 (core)",
"config 1.2.47 (core)",
"custom-metadata 1.0.12 (core)",
"data 0.6.4 (core)",
"generator 1.2.1 (core)",
"limits 1.2.3 (core)",
"org 1.9.0 (core)",
"salesforce-alm 53.4.2 (core)",
"schema 1.0.10 (core)",
"sfdx-cli 7.127.0 (core)",
"source 1.4.0 (core)",
"telemetry 1.2.8 (core)",
"templates 52.6.0 (core)",
"trust 1.0.10 (core)",
"user 1.5.2 (core)"
],
"osVersion": "Windows_NT 10.0.18362"
}

EDIT: this issue is just with one managed-package component (component efl__EFL_Child_Objects_List__c from the managed package Enhanced Files List). If I remove the component of the list of CustomObject elements, no issue is raised. If the object is in the list, a CustomObjectTranslation file is created during the retrieve and the error raises. The main problem is that I can´t remove the object name because we have to retrieve all the custom objects in the org using the wildcard (*) and, in that case, the error always raises
I will include more updates in the case #1241

@shetzel
Copy link
Contributor

shetzel commented Jan 13, 2022

The fix is in the latest CLI release published today. sfdx version 7.133.0

@shetzel shetzel closed this as completed Jan 13, 2022
@oalexandrino
Copy link

oalexandrino commented Jan 18, 2022

I have updated from 7.92.0-88320113e7 to 7.133.0-cddd46d and I'm still getting this error.

I have an item name "Contract-pt_BR.objectTranslation" in objectTranslations folder and I can upload/deploy it to ORG.

But when I insert this code in package XML and try to retrive it....

    <types>
        <members>Contract-pt_BR</members>
        <name>CustomObjectTranslation</name>
    </types> 

it says:

Unexpected child metadata [/force-app/main/default/objectTranslations/Contract-pt_BR/contract_contact_role.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

and if I open "Contract-pt_BR.objectTranslation" and try to retrieve directly...it removes from the XML file all fields that I had defined before

@shetzel
Copy link
Contributor

shetzel commented Jan 21, 2022

@oalexandrino - what's the exact command are you using to retrieve? Do you have a repo that we can use to reproduce this? What are your plugins? (sfdx plugins --core)

@filipecarvalho15
Copy link

Having the same issue in sfdx-cli/7.134.0

Unexpected child metadata [/force-app/main/default/objectTranslations/CampaignMember-de/et4ae5__Activity__c.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

@leosaraiva
Copy link

leosaraiva commented Feb 11, 2022

Hello guys,

I was having the same issue:

Unexpected child metadata [\force-app\main\default\objectTranslations\OpportunityLineItem-pt_BR\sales_price_opportunitylineitem.fieldTranslation-meta.xml] found for parent type [CustomObjectTranslation]

But i've found a work around here:

#1241 (comment)

Now I just add a .xml like this:

\force-app\main\default\objectTranslations\OpportunityLineItem-pt_BR\OpportunityLineItem-pt_BR.objectTranslation-meta.xml

Whenever the retrieve fails, I create this file whichever the branch I'm working on and I'm able to retrieve again.

I hope it helps.

@timpino
Copy link

timpino commented Feb 18, 2022

Same issue here using 7.138 on node12.22.5

EDIT: This is ran against a Japanese Org with quite a bit of metadata if that helps and loads of translations to english

EDIT2: Deleting Custom Object Translations folder at least lets me download the Custom Objects, but there is no way to get the translations out of the org using sfdx

@shetzel
Copy link
Contributor

shetzel commented Feb 24, 2022

Do any of you who are using CLI versions later than 7.133.0 have a repo we can use and reproducible steps? What is the exact command you're using to retrieve? What are your plugins? The test we have for this exact usecase is passing so we'd love to know how it differs from what you're doing.

@SurDevOps
Copy link

Starting SFDX: Retrieve Source from Org

Metadata API request failed: Component conversion failed: FILE_ENDED
7.142.1
sfdx version --verbose --json
{
"cliVersion": "sfdx-cli/7.142.1",
"architecture": "darwin-x64",
"nodeVersion": "node-v16.14.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 0.3.0 (core)",
"@oclif/plugin-commands 1.3.0 (core)",
"@oclif/plugin-help 3.3.1 (core)",
"@oclif/plugin-not-found 1.2.6 (core)",
"@oclif/plugin-plugins 1.10.11 (core)",
"@oclif/plugin-update 1.5.0 (core)",
"@oclif/plugin-warn-if-update-available 1.7.3 (core)",
"@oclif/plugin-which 1.0.4 (core)",
"@salesforce/sfdx-diff 0.0.6",
"@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)",
"alias 1.2.1 (core)",
"apex 0.11.0 (core)",
"auth 1.8.1 (core)",
"community 1.1.4 (core)",
"config 1.3.23 (core)",
"custom-metadata 1.0.12 (core)",
"data 0.6.9 (core)",
"generator 1.2.2 (core)",
"info 1.3.0 (core)",
"limits 1.3.0 (core)",
"mo-dx-plugin 0.3.2",
"org 1.11.2 (core)",
"salesforce-alm 54.0.1 (core)",
"schema 1.1.0 (core)",
"sfdx-cli 7.142.1 (core)",
"source 1.8.18 (core)",
"telemetry 1.4.0 (core)",
"templates 54.2.0 (core)",
"trust 1.1.0 (core)",
"user 1.7.1 (core)"
],
"osVersion": "Darwin 20.6.0"
}

sfdx plugins --core
@oclif/plugin-autocomplete 0.3.0 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.3.1 (core)
@oclif/plugin-not-found 1.2.6 (core)
@oclif/plugin-plugins 1.10.11 (core)
@oclif/plugin-update 1.5.0 (core)
@oclif/plugin-warn-if-update-available 1.7.3 (core)
@oclif/plugin-which 1.0.4 (core)
@salesforce/sfdx-diff 0.0.6
@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
alias 1.2.1 (core)
apex 0.11.0 (core)
auth 1.8.1 (core)
community 1.1.4 (core)
config 1.3.23 (core)
custom-metadata 1.0.12 (core)
data 0.6.9 (core)
generator 1.2.2 (core)
info 1.3.0 (core)
limits 1.3.0 (core)
mo-dx-plugin 0.3.2
org 1.11.2 (core)
salesforce-alm 54.0.1 (core)
schema 1.1.0 (core)
sfdx-cli 7.142.1 (core)
source 1.8.18 (core)
telemetry 1.4.0 (core)
templates 54.2.0 (core)
trust 1.1.0 (core)
user 1.7.1 (core)

@cristiand391
Copy link
Member

@SurDevOps that looks like a different error, could you please open a new issue with repro steps? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests