function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Guillaume ZeemanGuillaume Zeeman 

SFDX: Get socket connection timeouts when reset source tracking

When I try to reset the source tracking of my scratch org using the 'sfdx project reset tracking' SFDX command, I will always get an socket connection timeout. This command will fail with the following error message:

-----------------------------------------------------------------------------
Error (1): request to https://inspiration-app-6208-dev-ed.my.salesforce.com/services/data/v58.0/tooling/query/0r8xx1rSAGmGcutA2C-18000 failed, reason: Socket connection timeout

-----------------------------------------------------------------------------
It seems to timeout when retrieving the status of the files from the org using a REST API call. I've tried several things to try and fix this issue, all to no avail. 

I have tried to:

  1. First do a 'sfdx project reset tracking' before resetting the tracking
  2. Reverting to an older version of SFDX CLI
  3. Using the old 'sfdx force:source:tracking:reset' command
  4. Creating a new scratch org and trying to reset my source code with that one
  5. Try resetting my source tracking using a different wifi netwerk
  6. Use 'sfdx doctor' to retrieve log files
Does anyone know why this particular issue occurs or how to possibly solve it? 
SwethaSwetha (Salesforce Developers) 
HI Guillaume,
Can you ensure that you have a stable internet connection and that there are no network issues or firewalls blocking the connection to Salesforce servers?

> Also are you observing this behaviour with any specific version of SFDX CLI?If so, you might want to try downgrading  https://salesforce.stackexchange.com/questions/282941/downgrading-sfdx-cli

>Try increasing the timeout value using the --wait flag when running the sfdx force:source:push command.

Related: https://salesforce.stackexchange.com/questions/375488/forcesourcepush-metadata-api-request-failed-the-client-has-timed-out

https://github.com/forcedotcom/cli/issues/1149

If this information helps, please mark the answer as best. Thank you
Guillaume ZeemanGuillaume Zeeman
Thank you for your reply. The issue is not due to an instable internet connect. I've checked my network connectiviy and stability and have not discovered any issues. I've even tried several networks and the problem persists. Furthermore, the issue only seems to occur with the 'sfdx project reset tracking' command, but not other sfdx commands.

This issue also occurs in multiple SFDX versions. I've tried updating and downgrading to several versions of SFDX but to no avail. The problem also does not occur when pushing my changes to my scratch org, but rather when I try to sync my current source code with my scratch org.
SwethaSwetha (Salesforce Developers) 
Are you using Mac? I've seen a scenario in the past wherein updating the OS causes an issue with git, "invalid active developer path," where the solution is to install/update xcode.  (https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a) .Upon resetting xcode in order for git to function properly, it seems to have resolved the tracking issues in DX.

Let me know if this works for you. Thanks
Guillaume ZeemanGuillaume Zeeman

I am using a Mac and that problem does occur when you update your OS. But luckily I have already resolved that issue when I updated my Macbook recently. On a further note, I have discovered a workaround that fixes this particular problem. If I deploy a specific file to my scratch org using the push command (like 'sfdx project deploy start -m CustomObject:MyCustomObject__c') and then try to reset my source tracking, I do not receive an timeout anymore. 

My guess is that SFDX does something to the status of the source tracking which revolves the timeout issue.