salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

"Unable to load schema from '/Users/<user>/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json'

Open dschach opened this issue 1 year ago • 16 comments

Summary

Error shown when viewing scratch org definition file or sfdx-project.json in VSCode.

(Note: I cannot find the /Users/myuser/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce folder on my MacOs computer. I found node_modules, but not @salesforce.)

Steps To Reproduce

I can't show a repository because this is not repository-based.

It happens in multiple projects, for multiple files. There is an error that says Unable to load schema from '/Users/dschach/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json': ENOENT: no such file or directory, open '/Users/dschach/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/project-scratch-def.schema.json'.

It also happens when I open sfdx-project.json: Unable to load schema from '/Users/myuser/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json': ENOENT: no such file or directory, open '/Users/myuser/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json'.

{
  "versionDetail": {
    "architecture": "darwin-arm64",
    "cliVersion": "@salesforce/cli/2.57.7",
    "nodeVersion": "node-v20.16.0",
    "osVersion": "Darwin 23.6.0",
    "rootPath": "/Users/myuser/.local/share/sf/client/2.57.7-291554e",
    "shell": "zsh",
    "pluginVersions": [
      "@oclif/plugin-autocomplete 3.2.2 (core)",
      "@oclif/plugin-commands 4.0.13 (core)",
      "@oclif/plugin-help 6.2.10 (core)",
      "@oclif/plugin-not-found 3.2.18 (core)",
      "@oclif/plugin-plugins 5.4.6 (core)",
      "@oclif/plugin-search 1.2.7 (core)",
      "@oclif/plugin-update 4.5.5 (core)",
      "@oclif/plugin-version 2.2.11 (core)",
      "@oclif/plugin-warn-if-update-available 3.1.13 (core)",
      "@oclif/plugin-which 3.2.12 (core)",
      "@salesforce/cli 2.57.7 (core)",
      "apex 3.4.5 (core)",
      "api 1.2.1 (core)",
      "auth 3.6.51 (core)",
      "code-analyzer 5.0.0-alpha.1 (user)",
      "data 3.6.3 (core)",
      "deploy-retrieve 3.12.0 (core)",
      "dev 2.4.2 (user)",
      "info 3.4.2 (core)",
      "limits 3.3.27 (core)",
      "marketplace 1.2.24 (core)",
      "org 4.5.4 (core)",
      "packaging 2.8.0 (core)",
      "schema 3.3.26 (core)",
      "settings 2.3.15 (core)",
      "sobject 1.4.32 (core)",
      "source 3.5.16 (core)",
      "telemetry 3.6.10 (core)",
      "templates 56.3.14 (core)",
      "trust 3.7.25 (core)",
      "user 3.5.26 (core)",
      "@salesforce/sfdx-scanner 4.5.0 (user)"
    ]
  },
  "sfdxEnvVars": [],
  "sfEnvVars": [
    [
      "SF_BINPATH",
      "/Users/myuser/.local/share/sf/client/bin/sf"
    ],
    [
      "SF_AUTOUPDATE_DISABLE",
      "true"
    ],
    [
      "SF_DISABLE_AUTOUPDATE",
      "true"
    ],
    [
      "SF_UPDATE_INSTRUCTIONS",
      "Use \"npm update --global @salesforce/cli\" to update npm-based installations."
    ]
  ],
  "proxyEnvVars": [],
  "cliConfig": {
    "arch": "arm64",
    "bin": "sf",
    "binAliases": [
      "sfdx"
    ],
    "binPath": "/Users/myuser/.local/share/sf/client/bin/sf",
    "cacheDir": "/Users/myuser/Library/Caches/sf",
    "channel": "stable",
    "configDir": "/Users/myuser/.config/sf",
    "dataDir": "/Users/myuser/.local/share/sf",
    "dirname": "sf",
    "flexibleTaxonomy": true,
    "home": "/Users/myuser",
    "isSingleCommandCLI": false,
    "name": "@salesforce/cli",
    "nsisCustomization": "scripts/nsis.nsi",
    "platform": "darwin",
    "root": "/Users/myuser/.local/share/sf/client/2.57.7-291554e",
    "shell": "zsh",
    "theme": {
      "bin": "blueBright",
      "command": "blueBright",
      "dollarSign": "green",
      "flag": "green",
      "flagDefaultValue": "blueBright",
      "flagOptions": "blueBright",
      "flagRequired": "red",
      "sectionHeader": "blue",
      "topic": "blueBright",
      "json": {
        "brace": "whiteBright",
        "bracket": "whiteBright",
        "comma": "green",
        "key": "blueBright",
        "string": "greenBright",
        "number": "blue",
        "boolean": "redBright",
        "null": "blackBright"
      }
    },
    "topicSeparator": " ",
    "updateConfig": {
      "s3": {
        "bucket": "dfc-data-production",
        "host": "https://developer.salesforce.com",
        "templates": {
          "target": {
            "baseDir": "<%- bin %>",
            "manifest": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- platform %>-<%- arch %>",
            "unversioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-<%- platform %>-<%- arch %><%- ext %>",
            "versioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %>-<%- platform %>-<%- arch %><%- ext %>"
          },
          "vanilla": {
            "baseDir": "<%- bin %>",
            "manifest": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %>version",
            "unversioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %><%- ext %>",
            "versioned": "<%- channel === 'stable' ? '' : 'channels/' + channel + '/' %><%- bin %>-v<%- version %>/<%- bin %>-v<%- version %><%- ext %>"
          }
        }
      },
      "node": {}
    },
    "userAgent": "@salesforce/cli/2.57.7 darwin-arm64 node-v20.16.0",
    "valid": true,
    "version": "2.57.7",
    "warned": false,
    "windows": false,
    "_base": "@oclif/[email protected]",
    "_commands": {},
    "_topics": {},
    "commandPermutations": {
      "validPermutations": {}
    },
    "pluginLoader": {
      "options": {
        "root": "/Users/myuser/.local/share/sf/client/2.57.7-291554e/dist"
      },
      "errors": [],
      "plugins": {},
      "pluginsProvided": false
    },
    "topicPermutations": {
      "validPermutations": {}
    },
    "nodeEngine": ">=18.6.0"
  },
  "pluginSpecificData": {
    "@salesforce/plugin-deploy-retrieve": [
      {
        "sourceApiVersion": "61.0",
        "targetDevHubApiVersion": "61.0",
        "targetOrgApiVersion": "61.0"
      }
    ],
    "@salesforce/plugin-auth": [
      {
        "isUsingGenericKeychain": false,
        "sfCryptoV2Support": false,
        "cryptoVersion": "unknown"
      }
    ]
  },
  "diagnosticResults": [
    {
      "testName": "salesforcedx plugin isn’t installed",
      "status": "pass"
    },
    {
      "testName": "you don't have any linked plugins",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-trust] can ping: https://registry.npmjs.org",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-trust] can ping: https://registry.yarnpkg.com",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-trust] can ping: https://registry.npmjs.org/",
      "status": "pass"
    },
    {
      "testName": "using latest or latest-rc CLI version",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-deploy-retrieve] sourceApiVersion matches apiVersion",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-deploy-retrieve] default target DevHub max apiVersion matches default target org max apiVersion",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-deploy-retrieve] sourceApiVersion matches default target org max apiVersion",
      "status": "pass"
    },
    {
      "testName": "can access: https://test.salesforce.com",
      "status": "pass"
    },
    {
      "testName": "can access: https://appexchange.salesforce.com/services/data",
      "status": "pass"
    },
    {
      "testName": "can access: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-win32-x64-buildmanifest",
      "status": "pass"
    },
    {
      "testName": "[@salesforce/plugin-auth] CLI supports v2 crypto",
      "status": "fail"
    }
  ],
  "suggestions": [
    "Check https://github.com/forcedotcom/cli/issues for CLI issues posted by the community.",
    "Check http://status.salesforce.com for general Salesforce availability and performance.",
    "using npm registry https://registry.npmjs.org/ from npm config",
    "Your current installation of Salesforce CLI, including all the plugins you've linked and installed, doesn't yet support v2 crypto. All plugins and libraries must use at least version 6.7.0 of `@salesforce/core` to support v2 crypto. You're generally still able to successfully authenticate with your current CLI installation, but not if you generate a v2 crypto key."
  ],
  "logFilePaths": [],
  "commandExitCode": 0
}

Expected result

Actual result

Additional information

System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.57.7",
  "nodeVersion": "node-v20.16.0",
  "osVersion": "Darwin 23.6.0",
  "rootPath": "/Users/myuser/.local/share/sf/client/2.57.7-291554e",
  "shell": "zsh",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.2.2 (core)",
    "@oclif/plugin-commands 4.0.13 (core)",
    "@oclif/plugin-help 6.2.10 (core)",
    "@oclif/plugin-not-found 3.2.18 (core)",
    "@oclif/plugin-plugins 5.4.6 (core)",
    "@oclif/plugin-search 1.2.7 (core)",
    "@oclif/plugin-update 4.5.5 (core)",
    "@oclif/plugin-version 2.2.11 (core)",
    "@oclif/plugin-warn-if-update-available 3.1.13 (core)",
    "@oclif/plugin-which 3.2.12 (core)",
    "@salesforce/cli 2.57.7 (core)",
    "apex 3.4.5 (core)",
    "api 1.2.1 (core)",
    "auth 3.6.51 (core)",
    "code-analyzer 5.0.0-alpha.1 (user) published 14 days ago (Tue Aug 27 2024)",
    "data 3.6.3 (core)",
    "deploy-retrieve 3.12.0 (core)",
    "dev 2.4.2 (user) published 14 days ago (Mon Aug 26 2024)",
    "info 3.4.2 (core)",
    "limits 3.3.27 (core)",
    "marketplace 1.2.24 (core)",
    "org 4.5.4 (core)",
    "packaging 2.8.0 (core)",
    "schema 3.3.26 (core)",
    "settings 2.3.15 (core)",
    "sobject 1.4.32 (core)",
    "source 3.5.16 (core)",
    "telemetry 3.6.10 (core)",
    "templates 56.3.14 (core)",
    "trust 3.7.25 (core)",
    "user 3.5.26 (core)",
    "@salesforce/sfdx-scanner 4.5.0 (user) published 14 days ago (Tue Aug 27 2024)"
  ]
}

dschach avatar Sep 10 '24 23:09 dschach

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 Sep 10 '24 23:09 github-actions[bot]

This would be owned by the VSCode extensions team. I will transfer it over.

I am not seeing any other reports of this on their Issues repo so it could be a bad install? I would try fully uninstalling (and reinstalling) the VSCode extensions and the CLI.

iowillhoit avatar Sep 11 '24 18:09 iowillhoit

@dschach Please follow these steps For Mac and Linux, run the following:

  1. which sfdx
  2. which sf
  3. sfdx --version
  4. sf --version

For Windows, run the following:

  1. where sfdx
  2. where sf
  3. sfdx --version
  4. sf --version

If you have two different versions for sfdx --version and sf --version, follow these instructions to uninstall the CLI from both the installer and NPM, then reinstall the latest version of the CLI using one of those methods.

diyer avatar Sep 12 '24 18:09 diyer

/usr/local/bin/sfdx /usr/local/bin/sf sfdx --version @salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0 sf --version @salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

dschach avatar Sep 13 '24 19:09 dschach

Hi

I am experiencing the same issue with my setup. I have downgraded the package as was suggested on stackexchange but no change.

Have tried using the expanded pack with the same result.

image

image

which sfdx /usr/local/bin/sfdx

which sf
/usr/local/bin/sf

sfdx --version @salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

sf --version @salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

Telfie70 avatar Sep 14 '24 00:09 Telfie70

@dschach @Telfie70 Can you try cleaning out all the existing and old versions of your Salesforce extensions in VSCode and then reinstalling the extensions?

This is how to do that:

  1. In Teminal, go to .vscode/extensions from the home directory.
  2. Run rm -rf salesforce.salesforcedx* to delete all the Salesforce extensions.
  3. Quit and reopen VSCode.
  4. Reinstall the latest version of the Salesforce extensions.

daphne-sfdc avatar Sep 16 '24 19:09 daphne-sfdc

Hi @daphne-sfdc I also have the same issue. I run the codes you told in the git bash, cleared all extensions and re-installed them. Still have the issue.

where sfdx C:\Program Files\sf\bin\sfdx C:\Program Files\sf\bin\sfdx.cmd

where sf C:\Program Files\sf\bin\sf C:\Program Files\sf\bin\sf.cmd

sfdx version sf version @salesforce/cli/2.58.7 win32-x64 node-v20.17.0

YavuzCemal avatar Sep 16 '24 19:09 YavuzCemal

@YavuzCemal Please go to your User settings.json and add "json.schemas": [] to the end of that file, then reload the VSCode window. Let me know if that fixes the issue!

daphne-sfdc avatar Sep 16 '24 21:09 daphne-sfdc

@daphne-sfdc problem solved. ty.

YavuzCemal avatar Sep 16 '24 21:09 YavuzCemal

@YavuzCemal Great to hear your problem is now resolved! 🎊

@dschach @Telfie70 If cleaning and reinstalling your extensions doesn't work, please also try adding "json.schemas": [] to your User settings.json.

daphne-sfdc avatar Sep 16 '24 21:09 daphne-sfdc

@daphne-sfdc Did all that. Deleted directory. Installed extended pack. Got an error that one of the extensions requires the regular pack. Installed the regular pack as well. Added json.schema to settings. Opened project-scratch-def.json and still got the error.

It's asking for a folder called @salesforce and that's what isn't present.

dschach avatar Sep 17 '24 00:09 dschach

@dschach

Two questions:

  1. Are you seeing this as a warning or error?
  2. How does this affect your day-to-day operations, other than it showing up in the Problems tab and being annoying?

I see a warning in my Problems tab and everything was working fine for me, so I was wondering about the impact of this issue from your side. Screenshot 2024-09-17 at 11 47 33 AM

daphne-sfdc avatar Sep 17 '24 15:09 daphne-sfdc

It's not a blocker, but it's there and I figured the team would like to know :) It's orange, so a warning, I think. I'm still able to do my work - just unsure why it's happening and what part of the extension pack is looking for something that's not there. Thanks for looking into this

dschach avatar Sep 17 '24 16:09 dschach

This issue has been linked to a new work item: W-16771336

git2gus[bot] avatar Sep 17 '24 19:09 git2gus[bot]

Hello everyone, Multiple members of our team are seeing this warning, and we have concluded that it is a bug. We'll keep you updated on the status of fixing this bug in this issue.

daphne-sfdc avatar Sep 17 '24 19:09 daphne-sfdc

Hi @daphne-sfdc

I have removed the files and then reinstalled and still got the error.

I added "json.schemas": [] and still got the error

Unable to load schema from '/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json': ENOENT: no such file or directory, open '/Users/xxxx/.vscode/extensions/salesforce.salesforcedx-vscode-core-61.12.0/node_modules/@salesforce/schemas/sfdx-project.schema.json'.

I was able to authorise the org so it might be ok functionality wise but will only find out for sure once I start getting into the details.

Telfie70 avatar Sep 17 '24 21:09 Telfie70

This issue is not resolved with "json.schemas": [] for me either.

Zosoled avatar Oct 31 '24 14:10 Zosoled

I have been able to resolve this by simply adding the schemas manually to the extension folders. I can confirm, that there is no @salesforce/schemas in the relevant folder.

I used the schemas from the official schemas repo - no clue if there is a more up-to-date version.

❗ Snippets written for Mac, but should be easy to adapt to Windows/Linux. Obviously, you need to copy the exact location that it is looking for - replace Jannis.Schreiber with your username and 62.3.1 with your extension version. I basically copied the path from the inline error message that is thrown by VS Code.

SFDX Project Schema

wget https://raw.githubusercontent.com/forcedotcom/schemas/refs/heads/main/sfdx-project.schema.json && mv sfdx-project.schema.json /Users/Jannis.Schreiber/.vscode/extensions/salesforce.salesforcedx-vscode-core-62.3.1/node_modules/@salesforce/schemas/sfdx-project.schema.json

Scratch Def Schema

wget https://raw.githubusercontent.com/forcedotcom/schemas/refs/heads/main/project-scratch-def.schema.json && mv project-scratch-def.schema.json /Users/Jannis.Schreiber/.vscode/extensions/salesforce.salesforcedx-vscode-core-62.3.1/node_modules/@salesforce/schemas/project-scratch-def.schema.json

✅ Restart VS Code and you should be ready. Here's a screenshot with working auto-complete from the schema.

image

j-schreiber avatar Nov 11 '24 10:11 j-schreiber

@j-schreiber solution works although I assume it will have to be repeated each time the extension is updated. So weird that it's looking for these files in a directory that doesn't exist.

anthonygiuliano avatar Dec 08 '24 20:12 anthonygiuliano

@j-schreiber I went through this process and I am no longer getting the same error. But now I am getting an "Unable to parse content from (followed by the path)" error.

Did you by any chance encounter this?

dougcrew avatar Dec 23 '24 18:12 dougcrew

I can confirm the issue is still alive and well in 62.13.0.

drewagentsync avatar Jan 09 '25 20:01 drewagentsync

Also noting as occurring with this configuration:

where sfdx
C:\Users\...\AppData\Roaming\npm\sfdx
C:\Users\...\AppData\Roaming\npm\sfdx.cmd

where sf
C:\Users\...\AppData\Roaming\npm\sf
C:\Users\...\AppData\Roaming\npm\sf.cmd

sfdx --version
@salesforce/cli/2.70.7 win32-x64 node-v22.12.0

sf --version
@salesforce/cli/2.70.7 win32-x64 node-v22.12.0

cole-bradley avatar Jan 14 '25 02:01 cole-bradley

We have resolved this issue in the latest release v62.14.1 of the Salesforce Extensions for VSCode. Please update your extensions to the latest version and let us know if the error is gone from your end. Thank you, and happy coding! 🚀

daphne-sfdc avatar Jan 21 '25 17:01 daphne-sfdc