Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"URI malformed" error when execute "sf project retrieve start" or "sf project reset tracking" #2624

Closed
Ewaken opened this issue Dec 29, 2023 · 5 comments
Labels
bug Issue or pull request that identifies or fixes a bug validated Version information for this issue has been validated

Comments

@Ewaken
Copy link

Ewaken commented Dec 29, 2023

Summary

Hello, I use scratch orgs on my project and I had the error "URI malformed" on several sf commands:

  • sf project retrieve start
  • sf project reset tracking

I found a workaround to avoid this error, I had this stack trace when I executed these commands with "--dev-debug" ("sf project reset tracking --dev-debug" here) :

Error (1): URI malformed

*** Internal Diagnostic ***

URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at getDecodedKeyIfSourceMembersHas (C:\Users\*****\AppData\Roaming\npm\node_modules\@salesforce\cli\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:439:29)
    at RemoteSourceTrackingService.getSourceMember (C:\Users\*****\AppData\Roaming\npm\node_modules\@salesforce\cli\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:373:36)
    at C:\Users\*****\AppData\Roaming\npm\node_modules\@salesforce\cli\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:313:39
    at Array.forEach (<anonymous>)
    at RemoteSourceTrackingService.trackSourceMembers (C:\Users\*****\AppData\Roaming\npm\node_modules\@salesforce\cli\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:309:23)
    at RemoteSourceTrackingService.reset (C:\Users\*****\AppData\Roaming\npm\node_modules\@salesforce\cli\node_modules\@salesforce\source-tracking\lib\shared\remoteSourceTrackingService.js:152:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SourceTracking.resetRemoteTracking (C:\Users\*****\AppData\Roaming\npm\node_modules\@salesforce\cli\node_modules\@salesforce\source-tracking\lib\sourceTracking.js:389:30)
    at async Promise.all (index 0)
******

Then, I can try catch this block of code as follow, and everything work just fine:

function getDecodedKeyIfSourceMembersHas({ key, sourceMembers, logger, }) {
	try {
		const originalKeyDecoded = decodeURIComponent(key);
		const match = Array.from(sourceMembers.keys()).find((memberKey) => decodeURIComponent(memberKey) === originalKeyDecoded);
		if (match) {
			logger.debug(`${match} matches already tracked member: ${key}`);
			return match;
		}
	}catch(e) {
	}
    return key;
}

Expected result

No error thrown

Actual result

"URI malformed" Error

System Information

I used shell terminal

{
  "architecture": "win32-x64",
  "cliVersion": "@salesforce/cli/2.22.7",
  "nodeVersion": "node-v20.10.0",
  "osVersion": "Windows_NT 10.0.19045",
  "rootPath": "C:\\Users\\*****\\AppData\\Roaming\\npm\\node_modules\\@salesforce\\cli",
  "shell": "cmd.exe",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.3 (core)",
    "@oclif/plugin-commands 3.0.7 (core)",
    "@oclif/plugin-help 6.0.8 (core)",
    "@oclif/plugin-not-found 3.0.5 (core)",
    "@oclif/plugin-plugins 4.1.10 (core)",
    "@oclif/plugin-search 1.0.8 (core)",
    "@oclif/plugin-update 4.1.5 (core)",
    "@oclif/plugin-version 2.0.9 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.6 (core)",
    "@oclif/plugin-which 3.0.12 (core)",
    "@salesforce/cli 2.22.7 (core)",
    "apex 3.0.9 (core)",
    "auth 3.0.12 (core)",
    "community 3.0.7 (user)",
    "data 3.0.6 (core)",
    "deploy-retrieve 2.2.6 (core)",
    "info 3.0.8 (core)",
    "limits 3.0.6 (core)",
    "marketplace 1.0.11 (core)",
    "org 3.1.2 (core)",
    "packaging 1.27.10 (core)",
    "schema 3.0.8 (core)",
    "settings 2.0.9 (core)",
    "sobject 1.0.6 (core)",
    "source 3.0.3 (core)",
    "telemetry 3.1.6 (core)",
    "templates 56.0.4 (core)",
    "trust 3.2.0 (core)",
    "user 3.1.1 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.1.1 (user)",
    "@salesforce/sfdx-scanner 3.19.0 (user)"
  ]
}

Additional information

@Ewaken Ewaken added the investigating We're actively investigating this issue label Dec 29, 2023
Copy link

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 github-actions bot added the validated Version information for this issue has been validated label Dec 29, 2023
@cristiand391
Copy link
Member

@Ewaken a few questions:

  1. are you able to repro the error with previous version of the CLI?
  2. can you see the value of the key that's getting the getDecodedKeyIfSourceMembersHas function?

@Ewaken
Copy link
Author

Ewaken commented Jan 17, 2024

@Ewaken a few questions:

  1. are you able to repro the error with previous version of the CLI?
  2. can you see the value of the key that's getting the getDecodedKeyIfSourceMembersHas function?
  1. Yes I had this problem from few months and I'm not the only one in my team.
  2. Yes I have a lot of keys in error: ApexClasses, CustomLabels, Custom Metadatas... e.g.
    CustomMetadata__invalid_NAF_codes.X4761Z

@shetzel
Copy link
Contributor

shetzel commented Jan 17, 2024

I don't see an error when running decodeURIComponent('CustomMetadata__invalid_NAF_codes.X4761Z'). Regardless, I'll mark it as a bug and get a fix going.

@shetzel shetzel added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Jan 17, 2024
Copy link

git2gus bot commented Jan 17, 2024

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

@mshanemc mshanemc closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

4 participants