bitwarden / clients

Bitwarden client apps (web, browser extension, desktop, and cli).
https://bitwarden.com
Other
9.38k stars 1.26k forks source link

Bitwarden Desktop Fails to Launch on Startup with Username Containing Space (Windows) #11106

Open Nktech-Official opened 2 months ago

Nktech-Official commented 2 months ago

Steps To Reproduce

prerequisite windows app installed for a user (not system-wide) . User name Should have Space so Path to User Directory has Space Open Bitwarden Desktop. Navigate to Settings Enable the "Start automatically login" option Restart the computer.

Expected Result

After restarting, Bitwarden Desktop should automatically launch in the background or foreground (depending on settings).

Actual Result

Instead of launching, a popup window appears asking me to "choose an app to open the file."

The file path displayed in the popup is C:\Users\Nitesh (only the first part of my username). Clicking on any app or ignoring the popup doesn't seem to affect Bitwarden's functionality.

Screenshots or Videos

No response

Additional Context

Operating System

Bitwarden

Temporary Solution (Use with Caution):

Important Note: Modifying the Windows registry carries some risk. This is a temporary workaround and should only be attempted if necessary.

I was able to get Bitwarden to launch automatically on startup by following the steps outlined in a similar issue report here: #6524. This involves manually editing the Windows registry to add the path to the Bitwarden executable file in quotes within the "Start login" configuration.

After applying this workaround:

The checkbox for "Start login" within the Bitwarden app settings may appear unchecked. However, Bitwarden will still launch automatically on startup.

Operating System

Windows

Operating System Version

10 22H2

Installation method

Direct Download (from bitwarden.com)

Build Version

2024.8.2

Issue Tracking Info

jtodddd commented 2 months ago

Hi there,

I am unable to reproduce this issue, it has been escalated for further investigation. If you have more information that can help us, please add it below.

Thanks!

Nktech-Official commented 2 months ago

You can go into (Win + R) " RegEdit " and look for "Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

check what is the value for this register if there are multiple enterys look for electron.app Bitwarden on my system I Installed it for only my user Nitesh Mishra (it's the only user btw) so the executables are inside C:\Users\Nitesh Mishra\AppData\Local\Programs\Bitwarden\Bitwarden.exe this is the default value set by the Bitwarden app on turning on automatic start on login. the space the space in the path of executable is causing the issue so I changed the registry manually putting the executable path in quotes like this "C:\Users\Nitesh Mishra\AppData\Local\Programs\Bitwarden\Bitwarden.exe" .

To Reproduce

if you cannot reproduce kindly share the value for the registry "Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" look for electron.app Bitwarden

Kasheen commented 1 month ago

I have the same issue as @Nktech-Official.

Installing Bitwarden Desktop for Windows in single user mode and selecting run at startup in the settings results in the same issue.

Registry shows the same problem, the path is not quoted, and adding the quotes manually fixes it.

This all seems to be controlled by this code here:

app.setLoginItemSettings({ openAtLogin: true });

Which is a call into electron setLoginItemSettings:

path string (optional) Windows - The executable to launch at login. Defaults to process.execPath.

Which is a node API:

The process.execPath property returns the absolute pathname of the executable that started the Node.js process. Symbolic links, if any, are resolved.

Possible Root Cause:

All that to say - perhaps this is a bug in electron because it seems like setLoginItemSettings is not working as intended on Windows:

Here is the issue for that on the electron github.