cli icon indicating copy to clipboard operation
cli copied to clipboard

Error "Could not infer a metadata type" when retrieving source after successful decomposed metadata

Open smo17 opened this issue 3 months ago • 4 comments

Summary

Followed documentation to try out beta decomposed metadata commands : https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_decomposed_md_types.htm#sfdx_dev_ws_start_decompose

After successfully running sf command to decompose custom labels, permission set and sharing rules, new retrieve command on any other metadata from org result in error linked with custom label.

13:54:59.798 Starting SFDX: Retrieve This Source from Org No components retrieved \force-app\main\default\labels\ErrorMessage.label-meta.xml: Could not infer a metadata type

Steps To Reproduce

Expected result

Expecting retrieve command to work fine despite having decomposed metadata

Actual result

Getting error suggesting that decomposed folder/files under custom label are invalid

Additional information

System Information

Bash

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.108.6",
  "nodeVersion": "node-v22.12.0",
  "osVersion": "Windows_NT 10.0.26100",
  "rootPath": "C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "shell": "C:\\Program Files\\Git\\usr\\bin\\bash.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.35 (core)",
    "@oclif/plugin-commands 4.1.33 (core)",
    "@oclif/plugin-help 6.2.33 (core)",
    "@oclif/plugin-not-found 3.2.68 (core)",
    "@oclif/plugin-plugins 5.4.47 (core)",
    "@oclif/plugin-search 1.2.31 (core)",
    "@oclif/plugin-update 4.7.7 (core)",
    "@oclif/plugin-version 2.2.33 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.48 (core)",
    "@oclif/plugin-which 3.2.40 (core)",
    "@salesforce/cli 2.108.6 (core)",
    "agent 1.24.13 (core)",
    "apex 3.8.1 (core)",
    "api 1.3.3 (core)",
    "auth 3.9.8 (core)",
    "code-analyzer 5.0.0 (user) published 160 days ago (Tue Apr 29 2025) (latest is 5.5.0)",
    "data 4.0.57 (core)",
    "deploy-retrieve 3.23.3 (core)",
    "info 3.4.88 (core)",
    "limits 3.3.67 (core)",
    "marketplace 1.3.8 (core)",
    "org 5.9.30 (core)",
    "packaging 2.20.5 (user) published 13 days ago (Tue Sep 23 2025)",
    "schema 3.3.82 (core)",
    "settings 2.4.48 (core)",
    "sobject 1.4.73 (core)",
    "telemetry 3.6.57 (core)",
    "templates 56.3.65 (core)",
    "trust 3.7.113 (core)",
    "user 3.6.38 (core)",
    "sfdmu 4.38.0 (user) published 282 days ago (Sun Dec 29 2024)",
    "sfdx-git-delta 6.21.0 (user) published 10 days ago (Fri Sep 26 2025)",
    "sfdx-hardis 6.6.0 (link) C:\\Users\\User\\gitrepo\\sfdx-hardis",
    "texei-sfdx-plugin 2.8.3 (user) published 210 days ago (Mon Mar 10 2025) (latest is 2.8.4)"
  ]
}

smo17 avatar Oct 07 '25 10:10 smo17

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.

github-actions[bot] avatar Oct 07 '25 10:10 github-actions[bot]

Hello @smo17, could you please double check that your sfdx-project.json file has the sourceBehaviorOptions values set correctly? Like so:

Image

The only way that I was able to replicate the error your shared was by:

  • Converting my custom labels with sf project convert source-behavior --behavior decomposeCustomLabelsBeta2
  • Then removing the sourceBehaviorOptions values in my sfdx-config.json
  • Then finally doing a sf project retrieve start

Otherwise this is working as expect. If you are still having issues, could you share step-by-step instructions to reproduce this issue?

iowillhoit avatar Oct 08 '25 20:10 iowillhoit

@iowillhoit Yes, here is the sfdx-project.json file contains sourceBehaviorOptions.

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "name": "DEV_ORG",
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "64.0",
  "sourceBehaviorOptions": [
    "decomposeCustomLabelsBeta2"
  ]
}

After retry, the issue is happening when retrieving metadata via "Metadata Org Browser" feature in IDE.

Image

But retrieve from command seems to work fine sf project retrieve start --metadata CustomObject:Account So is the issue related to SF CLI or the VS code extension ?

Image

smo17 avatar Oct 09 '25 09:10 smo17

Interesting. So the VSCode extensions has its own version of the Source Deploy Retrieve library (which handles the registry variants). Earlier this week we had someone internally share the same issue, although they just said that they tried in a different project directory and it worked 🤔 They are going to do some more testing later today. Could you make sure your extensions are up to date and try again? If it's still an issue, we will transfer this to the VSCode team.

iowillhoit avatar Oct 15 '25 15:10 iowillhoit