cli icon indicating copy to clipboard operation
cli copied to clipboard

sf project retrieve start crashing because of inexplicable auth issue

Open nvuillam opened this issue 5 months ago • 6 comments

Description

I run the following command to retrieve metadatas:

sf org display --target-org [email protected] && sf project retrieve start --ignore-conflicts -o [email protected] --wait 60 --json

The org is logged

Org Description
┌──────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ KEY              │ VALUE                                                                                                            │
├──────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Access Token     │ 00DG5000006NVmT!AQEAQE404FoyyNI8FOBFUSCATEDxCc.JqB23tcwwdQlNi_xIudzB0rBtnQvYyD │
│ Api Version      │ 64.0                                                                                                             │
│ Client Id        │ PlatformCLI                                                                                                      │
│ Connected Status │ Connected                                                                                                        │
│ Id               │ 00DG5000006NVmTMAW                                                                                               │
│ Instance Url     │ https://hardis-group--playnico.sandbox.my.salesforce.com                                                         │
│ Username         │ [email protected]                                                                           │
└──────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

But then the retrieve fails because it does not find org auth

Image

I tried with multiple orgs, tried to re-authenticate, even after killing the JSONS are /root/.sf ... but nothing works

Expected result

The retrieve to work !

Actual result

  "name": "NamedOrgNotFoundError",
  "message": "Parsing --target-org \n\tNo authorization information found for [email protected].\nSee more help with --help",
  "exitCode": 1,
  "context": "RetrieveMetadata",
  "stack": "NamedOrgNotFoundError: Parsing --target-org \n\tNo authorization information found for [email protected].\nSee more help with --help\n    at SfCommandError.from (file:///C:/Users/33614/AppData/Local/sf/node_modules/@salesforce/sf-plugins-core/lib/SfCommandError.js:39:16)\n    at RetrieveMetadata.catch (file:///C:/Users/33614/AppData/Local/sf/node_modules/@salesforce/sf-plugins-core/lib/sfCommand.js:323:47)\n    at RetrieveMetadata.catch (file:///C:/Users/33614/AppData/Local/sf/node_modules/@salesforce/plugin-deploy-retrieve/lib/commands/project/retrieve/start.js:256:27)\n    at RetrieveMetadata._run (C:\\Users\\33614\\AppData\\Local\\sf\\node_modules\\@oclif\\core\\lib\\command.js:185:29)\n    at async Config.runCommand (C:\\Users\\33614\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli\\node_modules\\@oclif\\core\\lib\\config\\config.js:456:25)\n    at async run (C:\\Users\\33614\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli\\node_modules\\@oclif\\core\\lib\\main.js:97:16)\n    at async file:///C:/Users/33614/AppData/Roaming/npm/node_modules/@salesforce/cli/bin/run.js:15:1",
  "cause": "undefined",
  "warnings": [],
  "code": "NamedOrgNotFoundError",
  "status": 1,
  "commandName": "RetrieveMetadata"
}

Additional information

System Information

CLI:
@salesforce/cli/2.100.4 win32-x64 node-v22.14.0

Plugin Version:
@oclif/plugin-autocomplete 3.2.34 (core)
@oclif/plugin-commands 4.1.30 (core)
@oclif/plugin-help 6.2.32 (core)
@oclif/plugin-not-found 3.2.62 (core)
@oclif/plugin-plugins 5.4.46 (core)
@oclif/plugin-search 1.2.28 (core)
@oclif/plugin-update 4.7.2 (core)
@oclif/plugin-version 2.2.32 (core)
@oclif/plugin-warn-if-update-available 3.1.46 (core)
@oclif/plugin-which 3.2.39 (core)
@salesforce/cli 2.100.4 (core)
agent 1.23.7 (core)
apex 3.6.19 (core)
api 1.3.3 (core)
auth 3.7.14 (core)
code-analyzer 5.1.0 (user)
data 4.0.50 (core)
deploy-retrieve 3.22.38 (user)
dev 2.4.2 (user)
info 3.4.75 (core)
limits 3.3.61 (core)
marketplace 1.3.8 (core)
org 5.9.16 (core)
packaging 2.19.5 (user)
schema 3.3.76 (core)
settings 2.4.39 (core)
sobject 1.4.67 (core)
telemetry 3.6.51 (core)
templates 56.3.55 (core)
trust 3.7.113 (core)
user 3.6.31 (core)
@salesforce/sfdx-scanner 4.7.0 (user)
lightning-flow-scanner 2.22.0 (user)
sfdmu 4.38.0 (user)
sfdx-essentials 2.12.0 (user)
sfdx-git-delta 6.17.0 (user)
sfdx-hardis 5.45.0 (link) C:\git\pro\sfdx-hardis2
texei-sfdx-plugin 2.8.3 (user)
SF ENV. VARS.
SF_AUTOUPDATE_DISABLE,true
SF_DISABLE_AUTOUPDATE,true
SF_UPDATE_INSTRUCTIONS,Use "npm update --global @salesforce/cli" to update npm-based installations.
Windows: true
Shell: C:\Program Files\Git\usr\bin\bash.exe
Channel: stable

Diagnostics

:white_check_mark: pass - salesforcedx plugin isn’t installed :x: fail - you have at least one linked plugin :x: warn - [@salesforce/plugin-deploy-retrieve] sourceApiVersion matches apiVersion :white_check_mark: pass - [@salesforce/plugin-trust] can ping: https://registry.npmjs.org :white_check_mark: pass - [@salesforce/plugin-trust] can ping: https://registry.yarnpkg.com :white_check_mark: pass - [@salesforce/plugin-trust] can ping: https://registry.npmjs.org/ :white_check_mark: pass - using latest or latest-rc CLI version :white_check_mark: pass - can access: https://test.salesforce.com :white_check_mark: pass - can access: https://appexchange.salesforce.com/services/data :white_check_mark: pass - can access: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64-buildmanifest :x: fail - [@salesforce/plugin-auth] CLI supports v2 crypto :white_check_mark: pass - [@salesforce/plugin-auth] CLI using stable v1 crypto

nvuillam avatar Aug 10 '25 13:08 nvuillam

There is an issue with deploy-retrieve 3.22.38 (core) , which is not present in deploy-retrieve 3.22.36 (core)

After downgrading to deploy-retrieve 3.22.36, it works, so it means there is a bug in 3.22.38 :(

cc @cristiand391

nvuillam avatar Aug 10 '25 14:08 nvuillam

Hello @nvuillam I'm not able to repro the issue using deploy-retrieve 3.22.38 (core) .

Could you please share the log of the transaction where you get the error? You need to add --dev-debug > log.txt to the command. (please redact any personal information).

EstebanRomero84 avatar Aug 11 '25 17:08 EstebanRomero84

@EstebanRomero84 I succeeded to reproduce the issue, which happens only when i have a locally linked CLI plugin (sf plugins link)

With exact same plugin (sfdx-hardis) installed and not locally linked, it works perfectly. The content of the plugin does not change so it can not be caused by local changes in sfdx-hardis codebase.

Logs when working (no local link):

log-with-installed.txt SF Doctor

Logs when crashing (with local link)

log-with-local-link.txt SF Doctor

nvuillam avatar Aug 24 '25 08:08 nvuillam

Workaround (that clearly means that the issue is with latest version of salesforce CLI or one of its plugins :/ )

npm i @salesforce/[email protected] -g
sf plugins reset
sf plugins link (in sfdx-hardis repo root)
sf package installed list --target-org [email protected] (working again)

log-with-local-link-2.101.5.txt SF Doctor

@EstebanRomero84 please let me know if you need more info :)

nvuillam avatar Aug 24 '25 08:08 nvuillam

Hey @nvuillam, I am trying to understand the versions that are affected. A few questions:

  1. In your original post, you shared 2.100.4, did that also fail with a linked plugin?
  2. In your comments, it looks like 2.101.5 is working for you, but 2.102.6 is broken. Is that correct?
  3. Does this only happen when sfdx-hardis is linked? What happens if you link something else (like plugin-data)
  4. I was not able to reproduce this with 2.102.6 on a Mac. Have you heard from anyone with this issue on a Mac? If you suspect it is a Windows only issue, I'll have a team member try to reproduce it.

iowillhoit avatar Aug 26 '25 21:08 iowillhoit

@iowillhoit maybe it is a windows-only issue

I only developer sfdx-hardis so i don't have the issue with other plugins... but i've not linked them locally ^^ But if it was related to sfdx-hardis, why would it crash with local link but not with the installed version that contains the exact same code ?

To reproduce:

  • install latest @salesforce/cli with npm i @salesforce/cli@latest -g
  • clone https://github.com/hardisgroupcom/sfdx-hardis.git , then yarn && tsc && sf plugins link
  • run sf package installed list --target-org YOUR_ORG_USERNAME

nvuillam avatar Aug 28 '25 14:08 nvuillam