Error running Salesforce CLI

Issue #2416 resolved
Sebastian Munoz created an issue

Today I’ve started facing an issue with the plugin, basically, this start in a loop of the same issue:

I didn’t change anything, but I’ve lost all my connections and can't use the IDE.

Comments (13)

  1. Scott Wells repo owner

    It looks like either your CLI install is invalid or the path to it as registered with IC2 is incorrect. Please enable debug logging for Salesforce DX, reproduce the issue, and attach a new idea.log. That should show the exact execution that IC2 is performing so we can compare that to how the CLI is actually installed and registered.

  2. Sebastian Munoz reporter

    What I tried to fix:

    • Uninstall/Install Plugin
    • Uninstall/Install SFDX (different folders)

    Username/password connections work fine

  3. Scott Wells repo owner

    It also looks like you’re on a quite old install of the CLI with an odd install path. The script for the v2 CLI on Windows would normally be installed as C:\Program Files\sf\bin\sfdx.cmd. I would strongly recommend that you completely uninstall and reinstall the CLI to ensure that you’re on a clean, consistent version.

  4. Sebastian Munoz reporter
      <div class="preview-container wiki-content"><!-- loaded via ajax --></div>
      <div class="mask"></div>
    </div>
    

    </div> </form>

  5. Sebastian Munoz reporter

    The CLI is installed on C:/Program Files/sfdx/bin/sfdx.cmd, and is the one Im using in the configuration, I'm not sure why the plugin is looking in another place:

    2023-08-29 16:15:37,711 [ 109681]   INFO - #com.illuminatedcloud.intellij.settings.application.IlluminatedCloudConnectionConfig - Retrieving org list from Salesforce CLI because no cached org list was found.
    2023-08-29 16:15:37,711 [ 109681]   INFO - #com.illuminatedcloud.intellij.settings.application.IlluminatedCloudConnectionConfig - Retrieving org list information from Salesforce CLI.
    2023-08-29 16:15:37,712 [ 109682]   FINE - #com.illuminatedcloud.util.CommandLineUtil - Running command line: 'C:/Program Files/sfdx/bin/sfdx.cmd force:org:list --skipconnectionstatus --json' from working directory: 'D:\Code Backup\CMB - Archive\SourceCode\Dominion_DEV'.
    2023-08-29 16:15:37,734 [ 109704]   FINE - #com.illuminatedcloud.util.VariableLengthPollingInterval - C:/Program Files/sfdx/bin/sfdx.cmd force:org:list --skipconnectionstatus --json: Using polling interval 1000 ms for polling iteration 1.
    2023-08-29 16:15:38,024 [ 109994]   INFO - STDOUT -
    2023-08-29 16:15:38,741 [ 110711]   FINE - #com.illuminatedcloud.util.CommandLineUtil - Returning command-line response: CommandLineResponse{exitCode=1, output='', error=''"C:\Users\Sebastian\AppData\Local\sfdx\client\bin\..\7.209.6-8ba3197\bin\sfdx.cmd"' is not recognized as an internal or external command, 
    

  6. Scott Wells repo owner

    It looks like it is executing the command from the correct/expected location based on the current install, but it also looks like the CLI is failing when executed in that manner. My guess is that you can reproduce this from a raw command-line by running the following:

    "C:\Program Files\sfdx\bin\sfdx.cmd" force:org:list --skipconnectionstatus --json
    

    Assuming that shows the same type of failure, you should plan to completely uninstall the CLI as follows (make sure to remove the %LOCALAPPDATA% directories as well as those are what are being reported in these errors):

    https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm

    and install the latest-and-greatest version of the v2 CLI:

    https://developer.salesforce.com/tools/salesforcecli

  7. Scott Wells repo owner

    Were you able to reproduce the same behavior from a command-line in full isolation of IC2?

  8. Sebastian Munoz reporter

    That resolves the issue, not sure what's going one here, sf CLI becomes crazy, thanks for help!

  9. Scott Wells repo owner

    Yeah, I’ve seen quite a number of such issues with the CLI over the past few years, specifically when it’s upgraded in-place repeatedly over time. The good news is that the v2 CLI is vastly simplified in terms of its distribution and update process, and it doesn’t seem as fragile in that regard.

  10. Log in to comment