"Error (ELOCKED): Lock file is already being held" when logging out of many orgs
Summary
I was logged into 72 orgs in VS Code. I wanted to clean up this list by logging out of all but 2 orgs. Every time I ran sf org logout --all and deselected the 2 orgs I wanted to remain logged into, I got an error: Error (ELOCKED): Lock file is already being held. When I would run the command again, the total number of orgs was reduced by 10. This pattern repeated until the command successfully logged me out from the last 2 orgs.
In testing, the command ran successfully when logging out of 10 orgs, and failed for 11 or more.
Steps To Reproduce
- Authorize a Dev Hub
- Run
sf org create scratch --edition developer11 times - Run
sf org logout --all - Deselect your Dev Hub org
- Press Enter
I don't know how to create a repository that's configured to reproduce this issue. sf doctor hung when I ran sf org logout --all with it.
Expected result
The terminal outputs Successfully logged out of orgs: with a list of all orgs you logged out of.
Actual result
The terminal outputs: Error (ELOCKED): Lock file is already being held
Additional information
System Information
Terminal: powershell
{
"architecture": "win32-x64",
"cliVersion": "@salesforce/cli/2.88.6",
"nodeVersion": "node-v22.15.0",
"osVersion": "Windows_NT 10.0.22631",
"rootPath": "C:\\Users\\cassi\\AppData\\Local\\sf\\client\\2.88.6-85f5a40",
"shell": "cmd.exe",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.2.28 (core)",
"@oclif/plugin-commands 4.1.25 (core)",
"@oclif/plugin-help 6.2.28 (core)",
"@oclif/plugin-not-found 3.2.51 (core)",
"@oclif/plugin-plugins 5.4.37 (core)",
"@oclif/plugin-search 1.2.24 (core)",
"@oclif/plugin-update 4.6.39 (core)",
"@oclif/plugin-version 2.2.28 (core)",
"@oclif/plugin-warn-if-update-available 3.1.39 (core)",
"@oclif/plugin-which 3.2.35 (core)",
"@salesforce/cli 2.88.6 (core)",
"apex 3.6.17 (core)",
"api 1.3.3 (core)",
"auth 3.6.118 (core)",
"code-analyzer 5.0.0 (user) published 20 days ago (Tue Apr 29 2025)",
"data 4.0.30 (core)",
"deploy-retrieve 3.22.9 (core)",
"info 3.4.59 (core)",
"lightning-dev 1.8.0 (user) published 223 days ago (Tue Oct 08 2024) (latest is 2.10.3)",
"limits 3.3.53 (core)",
"marketplace 1.3.8 (core)",
"org 5.7.5 (core)",
"packaging 2.13.2 (core)",
"schema 3.3.61 (core)",
"settings 2.4.27 (core)",
"signups 2.6.25 (user) published 16 days ago (Sat May 03 2025) (latest is 2.6.28)",
"sobject 1.4.55 (core)",
"telemetry 3.6.40 (core)",
"templates 56.3.46 (core)",
"trust 3.7.87 (core)",
"user 3.6.20 (core)"
]
}
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.
This might be specific to Windows. I created 11 scratch orgs on a Mac and it successfully logged out of the 11 selected scratch orgs.