{"record":{"id":"7f11f46f95961cb1","repo":"beeradmoore/dlss-swapper","slug":"could-not-detect-ubisoftconnectinstallskey","errorCode":null,"errorMessage":"Could not detect ubisoftConnectInstallsKey.","messagePattern":"Could not detect ubisoftConnectInstallsKey\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Data/UbisoftConnect/UbisoftConnectLibrary.cs","lineNumber":81,"sourceCode":"        }\n\n        var cachedGames = GameManager.Instance.GetGames<UbisoftConnectGame>();\n\n        // Gat a list of installed games.\n        // NOTE: Some games are installed from Ubisoft Connect via Steam (eg. Far Cry: Blood Dragon)\n        // Those titles will show up in the Steam games list.\n        // Ironically Ubisoft Connect may show double gamess listed here if you do indeed own it from uplay/ubisoft connect and from 3rd party stores.\n        var installedTitles = new Dictionary<int, UbisoftGameRegistryRecord>();\n        try\n        {\n            using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))\n            {\n                using (var ubisoftConnectInstallsKey = hklm.OpenSubKey(@\"SOFTWARE\\Ubisoft\\Launcher\\Installs\"))\n                {\n                    // if ubisoftConnectRegistryKey is null then Ubisoft is not installed .\n                    if (ubisoftConnectInstallsKey is null)\n                    {\n                        throw new Exception(\"Could not detect ubisoftConnectInstallsKey.\");\n                    }\n\n                    var subKeyNames = ubisoftConnectInstallsKey.GetSubKeyNames();\n                    foreach (var subKeyName in subKeyNames)\n                    {\n                        // Only use the subKeyName that is a number (which is the installId.\n                        if (Int32.TryParse(subKeyName, out var installId))\n                        {\n                            using (var ubisoftConnectInstallDirKey = ubisoftConnectInstallsKey.OpenSubKey(subKeyName))\n                            {\n                                if (ubisoftConnectInstallDirKey is null)\n                                {\n                                    break;\n                                }\n\n                                var gameInstallDir = ubisoftConnectInstallDirKey.GetValue(\"InstallDir\") as string;\n                                if (string.IsNullOrEmpty(gameInstallDir) == false)\n                                {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/beeradmoore/dlss-swapper/blob/ab9b1e2d4bb04187c48fe58eeea06c2b0ea71fbb/src/Data/UbisoftConnect/UbisoftConnectLibrary.cs#L63-L99","documentation":"UbisoftConnectLibrary.ListGamesAsync opens the HKLM registry key SOFTWARE\\Ubisoft\\Launcher\\Installs to enumerate Ubisoft Connect game installs. If that key cannot be opened (returns null), Ubisoft Connect is not installed (or the launcher has never run), so the method throws instead of returning an empty list. It is a hard prerequisite failure: without install metadata no games can be detected.","triggerScenarios":"Calling ListGamesAsync on a machine where HKLM\\SOFTWARE\\Ubisoft\\Launcher\\Installs does not exist — Ubisoft Connect not installed, never launched, or running a legacy launcher version with a different registry layout. Also occurs under 32/64-bit registry view mismatch (the app not reading the WOW6432Node view where the key actually lives).","commonSituations":"Running the library on a clean machine or CI agent without Ubisoft Connect; portable/partial Ubisoft installs that never wrote the Installs key; scanning from a 32-bit process where the key is under Wow6432Node; corporate machines where HKLM write/read views are restricted.","solutions":["Install and launch Ubisoft Connect at least once so it writes HKLM\\SOFTWARE\\Ubisoft\\Launcher\\Installs, then retry.","Check the registry manually (reg query \"HKLM\\SOFTWARE\\Ubisoft\\Launcher\\Installs\"); if the key is only under Wow6432Node, open it with RegistryView.Registry32/64 explicitly.","Treat the exception as 'Ubisoft not installed' upstream and skip the Ubisoft provider instead of failing the whole scan.","Verify the process has permission to read HKLM (standard users can read, but restrictive policies can block it)."],"exampleFix":"// before\nusing (var ubisoftConnectInstallsKey = hklm.OpenSubKey(@\"SOFTWARE\\Ubisoft\\Launcher\\Installs\"))\n{\n    if (ubisoftConnectInstallsKey is null)\n        throw new Exception(\"Could not detect ubisoftConnectInstallsKey.\");\n// after\nusing (var hklm64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))\nusing (var ubisoftConnectInstallsKey = hklm64.OpenSubKey(@\"SOFTWARE\\Ubisoft\\Launcher\\Installs\"))\n{\n    if (ubisoftConnectInstallsKey is null)\n        return Enumerable.Empty<Game>(); // Ubisoft Connect simply not installed\n","handlingStrategy":"validation","validationCode":"using var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Default);\nusing var k32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);\nbool ubisoftInstalled = hklm.OpenSubKey(@\"SOFTWARE\\Ubisoft\\Launcher\\Installs\") != null\n    || k32.OpenSubKey(@\"SOFTWARE\\Ubisoft\\Launcher\\Installs\") != null;\nif (!ubisoftInstalled) { /* skip Ubisoft provider */ }","typeGuard":"static bool HasUbisoftInstallsKey()\n{\n    using var k = Registry.LocalMachine.OpenSubKey(@\"SOFTWARE\\Ubisoft\\Launcher\\Installs\");\n    return k != null;\n}","tryCatchPattern":"try\n{\n    var games = await library.ListGamesAsync();\n}\ncatch (Exception ex) when (ex.Message.Contains(\"ubisoftConnectInstallsKey\"))\n{\n    Logger.Info(\"Ubisoft Connect not installed; skipping.\");\n}","preventionTips":["Pre-check the registry key (both 32/64-bit views) before enumerating games.","Treat absence of a launcher's registry key as an expected 'not installed' state, not an exception.","Always launch-scan in a try/catch per provider so one missing launcher does not abort the whole scan."],"tags":["windows","registry","launcher-detection","ubisoft-connect"],"backgroundTag":"entity-not-found","analyzedSha":"ab9b1e2d4bb04187c48fe58eeea06c2b0ea71fbb","analyzedAt":"2026-09-15T05:25:32.979Z","contentChangedAt":"2026-09-15T05:25:32.979Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}