Skip to content

"Error (ELOCKED): Lock file is already being held" when logging out of many orgs #3296

@romnus

Description

@romnus

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

  1. Authorize a Dev Hub
  2. Run sf org create scratch --edition developer 11 times
  3. Run sf org logout --all
  4. Deselect your Dev Hub org
  5. 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

Image

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)"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a bugvalidatedVersion information for this issue has been validated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions