forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
474 stars 77 forks source link

sf project retrieve start -m "FieldSet:OBJECT.FIELD_SET_NAME" - Metadata API request failed: Cannot read properties of null (reading 'split') #2899

Closed zfrench closed 2 weeks ago

zfrench commented 1 month ago

Summary

I am trying to retrieve a field set from an org using the following command: sf project retrieve start -m "FieldSet:OBJECT.FIELD_SET_NAME and an error is being returned "Error (10): Metadata API request failed: Cannot read properties of null (reading 'split')". I have used this command before and confirm the api name of object and field are correct.

Steps To Reproduce

  1. Code for a project cannot be returned due it being confidential information.
  2. Create a fieldset in salesforce on either a standard or custom object.
  3. Update the command below with the object and field api names then run the command from the bash shell: sf project retrieve start -m "FieldSet:OBJECT.FIELD_SET_NAME"

Expected result

The fieldset should be retrieved from the Salesforce environment it was attempting to be retrieved from.

Actual result

Fieldset is not retrieved and an error message is produced. Error (10): Metadata API request failed: Cannot read properties of null (reading 'split')

System Information

Shell: GNU Bash, version 5.2.15(1)-release (x86_64-pc-msys)

sf version --verbose --json

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.44.8",
  "nodeVersion": "node-v20.7.0",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\USER_ID\\AppData\\Local\\Programs\\node-v20.7.0-win-x64\\node_modules\\@salesforce\\cli",
  "shell": "C:\\Users\\USER_ID\\AppData\\Local\\Programs\\Git\\usr\\bin\\bash.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.18 (core)",
    "@oclif/plugin-commands 3.3.4 (core)",
    "@oclif/plugin-help 6.0.22 (core)",
    "@oclif/plugin-not-found 3.1.10 (core)",
    "@oclif/plugin-plugins 5.1.3 (core)",
    "@oclif/plugin-search 1.0.24 (core)",
    "@oclif/plugin-update 4.2.14 (core)",
    "@oclif/plugin-version 2.1.2 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.19 (core)",
    "@oclif/plugin-which 3.1.10 (core)",
    "@salesforce/cli 2.44.8 (core)",
    "apex 3.1.13 (core)",
    "auth 3.6.17 (core)",
    "community 3.1.0 (user) published 69 days ago (Mon Mar 25 2024) (latest is 3.2.15)",
    "data 3.4.3 (core)",
    "deploy-retrieve 3.8.3 (core)",
    "info 3.3.3 (core)",
    "limits 3.3.9 (core)",
    "marketplace 1.2.8 (core)",
    "org 4.1.14 (core)",
    "packaging 2.1.5 (link) C:\\Users\\USER_ID\\AppData\\Local\\Programs\\node-v20.7.0-win-x64\\node_modules\\@salesforce\\plugin-packaging",
    "schema 3.3.9 (core)",
    "settings 2.2.7 (core)",
    "sobject 1.4.6 (core)",
    "source 3.3.18 (core)",
    "telemetry 3.3.11 (core)",
    "templates 56.2.9 (core)",
    "trust 3.7.3 (core)",
    "user 3.5.11 (core)",
    "sfdmu 4.33.5 (user) published 53 days ago (Thu Apr 11 2024) (latest is 4.33.17)",
    "sfdx-essentials 2.12.0 (user) published 901 days ago (Tue Dec 14 2021)",
    "sfdx-git-delta 5.34.0 (user) published 139 days ago (Tue Jan 16 2024) (latest is 5.40.0)",
    "sfdx-hardis 4.31.2 (user) published 53 days ago (Wed Apr 10 2024) (latest is 4.37.5)",
    "texei-sfdx-plugin 2.4.1 (user) published 68 days ago (Tue Mar 26 2024) (latest is 2.5.0)"
  ]
}

Additional information

github-actions[bot] commented 1 month ago

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.

cristiand391 commented 1 month ago

I'm created a field set on a custom object and was able to retrieve it:

➜  dreamhouse-lwc git:(main) ✗ sf -v
@salesforce/cli/2.44.8 darwin-x64 node-v20.10.0

Screenshot 2024-06-03 at 11 12 56 AM Screenshot 2024-06-03 at 11 13 22 AM

Could you run the command with the --dev-debug flag and share the debug logs? could something with your project or maybe git-bash.

zfrench commented 1 month ago

@cristiand391 Below is the partial output of the debug logs. I had to remove the file name directory and file references. I am actually seeing a new error now and the file fieldset is generated but produces the error message below.

Error (1): Metadata API request failed: Could not find HEAD.

dev-debug output: [11:26:29.630] (sf:core:config): Created 'sf:core:config' child logger instance [11:26:29.630] (sf): Setup child 'sf:core:config' logger instance [11:26:31.227] (sf:variants): Created 'sf:variants' child logger instance [11:26:31.228] (sf): Setup child 'sf:variants' logger instance [11:26:31.229] (sf:SfProjectJson): Created 'sf:SfProjectJson' child logger instance [11:26:31.229] (sf): Setup child 'sf:SfProjectJson' logger instance [11:26:31.229] DEBUG (sf:SfProjectJson): Reading config file: C:\Users\USER_ID\VSCode\project\sfdx-project.json [11:26:32.040] (sf:variants): Created 'sf:variants' child logger instance [11:26:32.040] (sf): Setup child 'sf:variants' logger instance [11:26:32.470] (sf:Config): Created 'sf:Config' child logger instance [11:26:32.471] (sf): Setup child 'sf:Config' logger instance [11:26:32.472] (sf:Config): Created 'sf:Config' child logger instance [11:26:32.472] (sf): Setup child 'sf:Config' logger instance [11:26:32.472] DEBUG (sf:Config): Reading config file: C:\Users\USER_ID.sf\config.json because hasRead is false [11:26:32.476] DEBUG (sf:Config): Reading config file: C:\Users\USER_ID\VSCode\project.sf\config.json because hasRead is false [11:26:32.531] (sf:OrgAccessor): Created 'sf:OrgAccessor' child logger instance [11:26:32.531] (sf): Setup child 'sf:OrgAccessor' logger instance [11:26:32.543] (sf:SandboxAccessor): Created 'sf:SandboxAccessor' child logger instance [11:26:32.543] (sf): Setup child 'sf:SandboxAccessor' logger instance [11:26:32.545] (sf:Org): Created 'sf:Org' child logger instance [11:26:32.545] (sf): Setup child 'sf:Org' logger instance [11:26:32.556] (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance [11:26:32.557] (sf): Setup child 'sf:AuthInfoConfig' logger instance [11:26:32.557] (sf:keyChain): Created 'sf:keyChain' child logger instance [11:26:32.557] (sf): Setup child 'sf:keyChain' logger instance [11:26:32.557] DEBUG (sf:keyChain): platform: win32 [11:26:32.561] (sf:crypto): Created 'sf:crypto' child logger instance [11:26:32.561] (sf): Setup child 'sf:crypto' logger instance [11:26:32.561] DEBUG (sf:crypto): Using v1 crypto [11:26:32.561] (sf:Lifecycle): Created 'sf:Lifecycle' child logger instance [11:26:32.561] (sf): Setup child 'sf:Lifecycle' logger instance [11:26:32.561] DEBUG (sf:Lifecycle): A lifecycle event with the name telemetry does not exist. An event must be registered before it can be emitted. [11:26:32.562] DEBUG (sf:AuthInfoConfig): Reading config file: C:\Users\USER_ID.sfdx\sandbox_username.json because hasRead is false [11:26:32.565] (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance [11:26:32.565] (sf): Setup child 'sf:AuthInfo' logger instance [11:26:32.579] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config. [11:26:32.580] (sf:connection): Created 'sf:connection' child logger instance [11:26:32.580] (sf): Setup child 'sf:connection' logger instance [11:26:32.585] DEBUG (sf:connection): API version cache last checked on 6/3/2024, 9:17:52 AM (now is 6/3/2024, 11:26:32 AM) [11:26:32.585] DEBUG (sf:connection): Using cached API version: 61.0 [11:26:32.585] DEBUG (sf:connection): Connection created with apiVersion 61.0 [11:26:32.586] (sf:Org): Created 'sf:Org' child logger instance [11:26:32.586] (sf): Setup child 'sf:Org' logger instance [11:26:32.596] (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance [11:26:32.596] (sf): Setup child 'sf:AuthInfoConfig' logger instance [11:26:32.596] (sf:keyChain): Created 'sf:keyChain' child logger instance [11:26:32.596] (sf): Setup child 'sf:keyChain' logger instance [11:26:32.596] DEBUG (sf:keyChain): platform: win32 [11:26:32.597] DEBUG (sf:AuthInfoConfig): Reading config file: C:\Users\USER_ID.sfdx\sandbox_username.json because hasRead is false [11:26:32.599] (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance [11:26:32.599] (sf): Setup child 'sf:AuthInfo' logger instance [11:26:32.610] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config. [11:26:32.610] (sf:connection): Created 'sf:connection' child logger instance [11:26:32.610] (sf): Setup child 'sf:connection' logger instance [11:26:32.610] DEBUG (sf:connection): API version cache last checked on 6/3/2024, 9:17:52 AM (now is 6/3/2024, 11:26:32 AM) [11:26:32.610] DEBUG (sf:connection): Using cached API version: 61.0 [11:26:32.610] DEBUG (sf:connection): Connection created with apiVersion 61.0 [11:26:32.614] DEBUG (sf:Lifecycle): lifecycle events with the name prerun have now been registered. When this event is emitted all 2 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): lifecycle events with the name init have now been registered. When this event is emitted all 2 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): 3 lifecycle events with the name init have now been registered. When this event is emitted all 3 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): 4 lifecycle events with the name init have now been registered. When this event is emitted all 4 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): 3 lifecycle events with the name prerun have now been registered. When this event is emitted all 3 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): 4 lifecycle events with the name prerun have now been registered. When this event is emitted all 4 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): lifecycle events with the name postrun have now been registered. When this event is emitted all 2 listeners will fire. [11:26:32.614] DEBUG (sf:Lifecycle): 5 lifecycle events with the name init have now been registered. When this event is emitted all 5 listeners will fire. [11:26:32.623] (sf:Org): Created 'sf:Org' child logger instance [11:26:32.623] (sf): Setup child 'sf:Org' logger instance [11:26:32.634] (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance [11:26:32.634] (sf): Setup child 'sf:AuthInfoConfig' logger instance [11:26:32.646] (sf:keyChain): Created 'sf:keyChain' child logger instance [11:26:32.646] (sf): Setup child 'sf:keyChain' logger instance [11:26:32.646] DEBUG (sf:keyChain): platform: win32 [11:26:32.646] DEBUG (sf:AuthInfoConfig): Reading config file: C:\Users\USER_ID.sfdx\sandbox_username.json because hasRead is false [11:26:32.648] (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance [11:26:32.648] (sf): Setup child 'sf:AuthInfo' logger instance [11:26:32.660] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config. [11:26:32.661] (sf:connection): Created 'sf:connection' child logger instance [11:26:32.661] (sf): Setup child 'sf:connection' logger instance [11:26:32.661] DEBUG (sf:connection): API version cache last checked on 6/3/2024, 9:17:52 AM (now is 6/3/2024, 11:26:32 AM) [11:26:32.661] DEBUG (sf:connection): Using cached API version: 61.0 [11:26:32.661] DEBUG (sf:connection): Connection created with apiVersion 61.0 [11:26:32.661] (sf:Org): Created 'sf:Org' child logger instance [11:26:32.661] (sf): Setup child 'sf:Org' logger instance [11:26:32.672] (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance [11:26:32.672] (sf): Setup child 'sf:AuthInfoConfig' logger instance [11:26:32.672] (sf:keyChain): Created 'sf:keyChain' child logger instance [11:26:32.672] (sf): Setup child 'sf:keyChain' logger instance [11:26:32.672] DEBUG (sf:keyChain): platform: win32 [11:26:32.672] DEBUG (sf:AuthInfoConfig): Reading config file: C:\Users\USER_ID.sfdx\sandbox_username.json because hasRead is false [11:26:32.674] (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance [11:26:32.674] (sf): Setup child 'sf:AuthInfo' logger instance [11:26:32.686] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config. [11:26:32.686] (sf:connection): Created 'sf:connection' child logger instance [11:26:32.686] (sf): Setup child 'sf:connection' logger instance [11:26:32.686] DEBUG (sf:connection): API version cache last checked on 6/3/2024, 9:17:52 AM (now is 6/3/2024, 11:26:32 AM) [11:26:32.686] DEBUG (sf:connection): Using cached API version: 61.0 [11:26:32.686] DEBUG (sf:connection): Connection created with apiVersion 61.0 [11:26:32.688] DEBUG (sf:connection): request method: "GET" url: "https://CUSTOM_DOMAIN.sandbox.my.salesforce.com/services/data/v61.0/tooling/sobjects/SourceMember/describe" headers: { "content-type": "application/json", "user-agent": "sfdx toolbelt:" } [11:26:33.264] (sf:SourceTracking): Created 'sf:SourceTracking' child logger instance [11:26:33.264] (sf): Setup child 'sf:SourceTracking' logger instance [11:26:33.264] (sf:variants): Created 'sf:variants' child logger instance [11:26:33.264] (sf): Setup child 'sf:variants' logger instance [11:26:33.266] DEBUG (sf:SourceTracking): subscribing to predeploy/retrieve events [11:26:33.266] DEBUG (sf:SourceTracking): subscribing to postdeploy/retrieve events [11:26:33.267] (sf:SfProjectJson): Created 'sf:SfProjectJson' child logger instance [11:26:33.267] (sf): Setup child 'sf:SfProjectJson' logger instance [11:26:33.267] DEBUG (sf:SfProjectJson): Reading config file: C:\Users\USER_ID.sfdx\sfdx-project.json because hasRead is false [11:26:33.281] (sf:componentSetBuilder): Created 'sf:componentSetBuilder' child logger instance [11:26:33.281] (sf): Setup child 'sf:componentSetBuilder' logger instance [11:26:33.281] (sf:variants): Created 'sf:variants' child logger instance [11:26:33.281] (sf): Setup child 'sf:variants' logger instance [11:26:33.283] DEBUG (sf:componentSetBuilder): Building ComponentSet from metadata: FieldSet:CustomObject__c.CustomObject_Fields [11:26:33.283] (sf:ComponentSet): Created 'sf:ComponentSet' child logger instance [11:26:33.283] (sf): Setup child 'sf:ComponentSet' logger instance [11:26:33.283] (sf:ComponentSet): Created 'sf:ComponentSet' child logger instance [11:26:33.283] (sf): Setup child 'sf:ComponentSet' logger instance [11:26:33.283] DEBUG (sf:componentSetBuilder): Searching for matching metadata in directories: C:\Users\USER_ID\VSCode\PROJECT_DIRECTORY [11:26:33.283] (sf:ComponentSet): Created 'sf:ComponentSet' child logger instance [11:26:33.283] (sf): Setup child 'sf:ComponentSet' logger instance [11:26:45.286] DEBUG (sf:componentSetBuilder): Matching metadata files (1): [11:26:45.286] DEBUG (sf:componentSetBuilder): C:\Users\USER_ID\VSCode\project\sfdx-source\project_name\main\default\objects\CustomObject__c\fieldSets\CustomObject_Fields.fieldSet-meta.xml [11:26:45.286] DEBUG (sf:componentSetBuilder): ComponentSet apiVersion = undefined [11:26:45.286] DEBUG (sf:componentSetBuilder): ComponentSet sourceApiVersion = 60.0 [11:26:45.287] (sf:variants): Created 'sf:variants' child logger instance [11:26:45.287] (sf): Setup child 'sf:variants' logger instance [11:26:45.289] (sf:variants): Created 'sf:variants' child logger instance [11:26:45.289] (sf): Setup child 'sf:variants' logger instance [11:26:45.290] (sf:ComponentSet): Created 'sf:ComponentSet' child logger instance [11:26:45.290] (sf): Setup child 'sf:ComponentSet' logger instance [11:26:45.291] (sf:MetadataApiRetrieve): Created 'sf:MetadataApiRetrieve' child logger instance [11:26:45.291] (sf): Setup child 'sf:MetadataApiRetrieve' logger instance [11:26:45.291] (sf:AuthInfoConfig): Created 'sf:AuthInfoConfig' child logger instance [11:26:45.291] (sf): Setup child 'sf:AuthInfoConfig' logger instance [11:26:45.291] (sf:keyChain): Created 'sf:keyChain' child logger instance [11:26:45.291] (sf): Setup child 'sf:keyChain' logger instance [11:26:45.291] DEBUG (sf:keyChain): platform: win32 [11:26:45.291] DEBUG (sf:AuthInfoConfig): Reading config file: C:\Users\USER_ID.sfdx\sandbox_username.json because hasRead is false [11:26:45.296] (sf:AuthInfo): Created 'sf:AuthInfo' child logger instance [11:26:45.296] (sf): Setup child 'sf:AuthInfo' logger instance [11:26:45.309] INFO (sf:AuthInfo): Returning fields for a connection using OAuth config. [11:26:45.310] (sf:connection): Created 'sf:connection' child logger instance [11:26:45.310] (sf): Setup child 'sf:connection' logger instance [11:26:45.310] DEBUG (sf:connection): API version cache last checked on 6/3/2024, 9:17:52 AM (now is 6/3/2024, 11:26:45 AM) [11:26:45.310] DEBUG (sf:connection): Using cached API version: 61.0 [11:26:45.310] DEBUG (sf:connection): Connection created with apiVersion 61.0 [11:26:45.311] DEBUG (sf:SourceTracking): received scopedPreRetrieve event [11:26:45.311] DEBUG (sf:SourceTracking): ensureRemoteTracking: remote tracking does not exist yet; getting instance [11:26:45.311] DEBUG (sf:connection): request method: "GET" url: "https://CUSTOM_DOMAIN.sandbox.my.salesforce.com/services/data/v61.0/tooling/sobjects/SourceMember/describe" headers: { "content-type": "application/json", "user-agent": "sfdx toolbelt:" } [11:26:45.316] (sf:ShadowRepo): Created 'sf:ShadowRepo' child logger instance [11:26:45.316] (sf): Setup child 'sf:ShadowRepo' logger instance [11:26:45.317] (sf:ShadowRepo): start: getStatus (noCache = false) [11:26:52.828] (sf:ShadowRepo): done: getStatus (noCache = false) [11:26:52.829] (sf:ShadowRepo): start: getStatus (noCache = false) [11:26:52.829] (sf:ShadowRepo): done: getStatus (noCache = false) [11:26:52.833] DEBUG (sf:SourceTracking): ensureRemoteTracking: remote tracking already exists [11:26:52.834] DEBUG (RemoteSourceTrackingService): Query: SELECT MemberType, MemberName, IsNameObsolete, RevisionCounter FROM SourceMember WHERE RevisionCounter > 90865 [11:26:52.835] DEBUG (sf:connection): request method: "GET" url: "https://CUSTOM_DOMAIN.sandbox.my.salesforce.com/services/data/v61.0/tooling/query?q=SELECT%20MemberType%2C%20MemberName%2C%20IsNameObsolete%2C%20RevisionCounter%20FROM%20SourceMember%20WHERE%20RevisionCounter%20%3E%2090865" headers: { "content-type": "application/json", "user-agent": "sfdx toolbelt:" } Retrieving v60.0 metadata from sandbox_username using the v61.0 SOAP API [11:26:53.119] DEBUG (RemoteSourceTrackingService): Found 3019 elements not synced with org [11:26:53.119] DEBUG (sf:SourceTracking):

cristiand391 commented 1 month ago

Error (1): Metadata API request failed: Could not find HEAD.

it says it's an API error but I'm pretty sure it's coming from the source-tracking library: https://github.com/search?q=repo%3Aisomorphic-git%2Fisomorphic-git+%2FCould+not+find+HEAD%2F&type=issues

did you cut out some part at the end of the logs? there's no errors in what you shared.

Since you can't repro the original error (Cannot read properties of null (reading 'split')) and now get a source-tracking one, could you retry this using a new scratch org with the same project? if that works then maybe your source tracking info in the previous org got messed up.

github-actions[bot] commented 3 weeks ago

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.