I also had this issue with Chrome. I have no idea why this error exists but you could just add in a DisplayName with the registry editor. I went into regedit to: `Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome` and added in a new `String Value` and called it "DisplayName". That appears to silence the error.

For the sake of having logs, here's my log output with a similar error message for the DisplayName:

```
D:\src>bazel version
ERROR: Failed to query DisplayName of HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
INFO: Invocation ID: ee818f56-b420-4910-a9fe-b54b73650abe
Build label: 0.20.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Nov 30 14:38:51 2018 (1543588731)
Build timestamp: 1543588731
Build timestamp as int: 1543588731

``` Thanks @cnishina ! If I'm not mistaken the error is non-fatal. Is that correct?
I'll fix the code not to show even the error. Bazel should just acknowledge that it can't read some registry key and carry on silently.

(And for the record, that warning about "--batch mode" is also benign, it just indicates that you are not running Bazel from a workspace, i.e. `d:\src` directory has no WORKSPACE file in it, nor do any of its parent directories.) That is correct, it is not a fatal error. I just commented on how I resolved the registry problem.
Windows: "Failed to query DisplayName of" in Bazel client
### Description of the problem / feature request:

Bazel displays:
```
ERROR: Failed to query DisplayName of HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\Free mp3 Wma Converter
```

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

https://stackoverflow.com/q/53307267/7778502

Culprit seems to be an unhandled error opening a registry subkey here:
https://github.com/bazelbuild/bazel/blob/cd2a036ffff99087be125253157d16d60289e33a/src/main/cpp/blaze_util_windows.cc#L1359

### What operating system are you running Bazel on?

Windows

### What's the output of `bazel info release`?

```
Build label: 0.18.0- (@non-git)

Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/bu ild/lib/bazel/BazelServer_deploy.jar

Build time: Sun Oct 28 04:25:08 2018 (1540700708)

Build timestamp: 1540700708

Build timestamp as int: 1540700708
```
src/main/cpp/blaze_util_windows.cc
src/main/cpp/blaze_util_windows.cc
diff --git a/src/main/cpp/blaze_util_windows.cc b/src/main/cpp/blaze_util_windows.cc
index 1483dfb9b76a22..a8ccacba1096e9 100644
--- a/src/main/cpp/blaze_util_windows.cc
+++ b/src/main/cpp/blaze_util_windows.cc
@@ -1358,9 +1358,9 @@ static string GetMsysBash() {
                         value,          // _Out_opt_   LPBYTE  lpData,
                         &value_length   // _Inout_opt_ LPDWORD lpcbData
                         )) {
-      BAZEL_LOG(ERROR) << "Failed to query DisplayName of HKCU\\" << key << "\\"
-                       << subkey_name;
-      continue;  // try next subkey
+      // This registry key has no DisplayName subkey, so it cannot be MSYS2, or
+      // it cannot be a version of MSYS2 that we are looking for.
+      continue;
     }
 
     if (value_type == REG_SZ &&
@@ -1378,16 +1378,17 @@ static string GetMsysBash() {
               path,               // _Out_opt_   LPBYTE  lpData,
               &path_length        // _Inout_opt_ LPDWORD lpcbData
               )) {
-        BAZEL_LOG(ERROR) << "Failed to query InstallLocation of HKCU\\" << key
-                         << "\\" << subkey_name;
+        // This version of MSYS2 does not seem to create a "InstallLocation"
+        // subkey. Let's ignore this registry key to avoid picking up an MSYS2
+        // version that may be different from what Bazel expects.
         continue;  // try next subkey
       }
 
       if (path_length == 0 || path_type != REG_SZ) {
-        BAZEL_LOG(ERROR) << "Zero-length (" << path_length
-                         << ") install location or wrong type (" << path_type
-                         << ")";
-        continue;  // try next subkey
+        // This version of MSYS2 seem to have recorded an empty installation
+        // location, or the registry key was modified. Either way, let's ignore
+        // this registry key and keep looking at the next subkey.
+        continue;
       }
 
       BAZEL_LOG(INFO) << "Install location of HKCU\\" << key << "\\"
@@ -1395,11 +1396,13 @@ static string GetMsysBash() {
       string path_as_string(path, path + path_length - 1);
       string bash_exe = path_as_string + "\\usr\\bin\\bash.exe";
       if (!blaze_util::PathExists(bash_exe)) {
-        BAZEL_LOG(INFO) << bash_exe.c_str() << " does not exist";
-        continue;  // try next subkey
+        // The supposed bash.exe does not exist. Maybe MSYS2 was deleted but not
+        // uninstalled? We can't tell, but for all we care, this MSYS2 path is
+        // not what we need, so ignore this registry key.
+        continue;
       }
 
-      BAZEL_LOG(INFO) << "Detected msys bash at " << bash_exe.c_str();
+      BAZEL_LOG(INFO) << "Detected MSYS2 Bash at " << bash_exe.c_str();
       return bash_exe;
     }
   }
