Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

VS Code cannot sign in to GitHub on Linux because of the OS keyring

ErrorCannot create an item in a locked collection

Short answer

VS Code stores your sign-in token in the desktop keyring. If the keyring is locked, not running, or VS Code picks the wrong backend, sign-in fails. Run VS Code with the verbose OSCrypt log to see the backend, unlock the default keyring, or set the password-store runtime argument.

  • Applies to VS Code 1.10x on Ubuntu 24.04 (GNOME), VS Code on KDE
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Start VS Code from a terminal with the verbose flag. Then search the log for OSCrypt, password storage or selected backend to see which keyring VS Code chose.

    code --verbose --vmodule="*/components/os_crypt/*=1"
  2. 2Match what you see, then jump to its fix

    1. 1Cannot create an item in a locked collectionThe GNOME keyring is lockedFix
    2. 2The log names a backend you do not use (for example a KWallet backend on a GNOME desktop)The wrong keyring backend is selectedFix
    3. 3Running KDE and the log shows a KWallet backend failingKDE: the wallet is closed or not reachableFix

What does the error look like?

  • Cannot create an item in a locked collection
  • GitHub sign-in in VS Code does not complete or does not stay signed in

Cause 1 of 3

The GNOME keyring is locked

1Check

The log line above means VS Code reached the keyring but the default collection, usually called Login, is locked. It is unlocked when you sign in to the OS, so autologin or a non-password login leaves it locked.

code --verbose --vmodule="*/components/os_crypt/*=1" 2>&1 | grep -i -E 'locked|backend'

2Fix

Unlock the default Login keyring with a keyring manager such as Seahorse, then sign in to GitHub in VS Code again.

seahorse

3Verify

Sign in again from the Accounts menu; the account stays after restarting VS Code.

code --verbose --vmodule="*/components/os_crypt/*=1"

Confirmed by code.visualstudio.com

Did this fix it?

Cause 2 of 3

The wrong keyring backend is selected

1Check

VS Code detects the desktop environment itself. If it detects it wrongly, tell it the backend directly with the password-store argument. The supported values are gnome-libsecret, kwallet5, kwallet and basic.

code --password-store="gnome-libsecret"

2Fix

If that start works, make it permanent: run Preferences: Configure Runtime Arguments from the Command Palette and add the value to argv.json.

{
  "password-store": "gnome-libsecret"
}

3Verify

Restart VS Code and sign in to GitHub again.

code --verbose --vmodule="*/components/os_crypt/*=1"

Confirmed by code.visualstudio.com

Did this fix it?

Cause 3 of 3

KDE: the wallet is closed or not reachable

1Check

On KDE, VS Code needs the default wallet, kdewallet, to be open in KWalletManager.

code --verbose --vmodule="*/components/os_crypt/*=1" 2>&1 | grep -i kwallet

2Fix

Open KWalletManager and open the default wallet. If VS Code still cannot connect, use a keyring that implements the Secret Service API and set password-store to gnome-libsecret.

{
  "password-store": "gnome-libsecret"
}

3Verify

Restart VS Code and sign in again.

code --password-store="gnome-libsecret"

Confirmed by code.visualstudio.com

Did this fix it?

How do I stop it coming back?

  • Sign in to your desktop with a password so the Login keyring unlocks with the session.
  • Keep the password-store value in argv.json so every start uses the same backend.
  • Avoid the basic backend: VS Code warns it is only obfuscation, and other processes may be able to decrypt it.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Related fixes

Servers

dnf cannot install MySQL on Amazon Linux 2023

dnf cannot find a mysql-server package on Amazon Linux 2023

Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.