{"record":{"id":"d534faa2b85fdeb9","repo":"browsh-org/browsh","slug":"error-reading-windows-registry-w","errorCode":null,"errorMessage":"Error reading Windows registry: %w","messagePattern":"Error reading Windows registry: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"interfacer/src/browsh/firefox_windows.go","lineNumber":23,"sourceCode":"import (\n\t\"fmt\"\n\t\"log/slog\"\n\t\"strings\"\n\n\t\"github.com/go-errors/errors\"\n\t\"golang.org/x/sys/windows/registry\"\n)\n\nfunc getFirefoxPath() string {\n\tversionString := getWindowsFirefoxVersionString()\n\tflavor := getFirefoxFlavor()\n\n\tk, err := registry.OpenKey(\n\t\tregistry.LOCAL_MACHINE,\n\t\t`Software\\Mozilla\\`+flavor+`\\`+versionString+`\\Main`,\n\t\tregistry.QUERY_VALUE)\n\tif err != nil {\n\t\tShutdown(fmt.Errorf(\"Error reading Windows registry: %w\", err))\n\t}\n\tdefer k.Close()\n\n\tpath, _, err := k.GetStringValue(\"PathToExe\")\n\tif err != nil {\n\t\tShutdown(fmt.Errorf(\"Error reading Windows registry: %w\", err))\n\t}\n\n\treturn path\n}\n\nfunc getWindowsFirefoxVersionString() string {\n\tflavor := getFirefoxFlavor()\n\n\tk, err := registry.OpenKey(\n\t\tregistry.LOCAL_MACHINE,\n\t\t`Software\\Mozilla\\`+flavor,\n\t\tregistry.QUERY_VALUE)","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/browsh-org/browsh/blob/499ef386d45cd1e2b5457dd04887c017f77b7e27/interfacer/src/browsh/firefox_windows.go#L5-L41","documentation":"getFirefoxPath looks up the installed Firefox executable under HKLM\\Software\\Mozilla\\<flavor>\\<versionString>\\Main and reads PathToExe. If OpenKey fails (key or version subkey missing, or 32/64-bit view mismatch) browsh calls Shutdown, terminating with this wrapped error. It means browsh could not find the registry entry it uses to locate Firefox on Windows.","triggerScenarios":"registry.OpenKey on LOCAL_MACHINE for `Software\\Mozilla\\<flavor>\\<versionString>\\Main` returns an error: the exact version subkey does not exist, Firefox was installed per-user (under HKCU) instead of machine-wide, or the key is not visible to the current registry view.","commonSituations":"Firefox not installed at all; installed via a per-user installer (no HKLM entry); multiple Firefox versions installed and the computed versionString subkey differs from the actual key name; 32-bit browsh running on 64-bit Windows without WOW64 redirection handling.","solutions":["Verify Firefox is installed machine-wide by checking HKLM\\Software\\Mozilla in regedit.","Install the official Firefox build so the Main key with PathToExe exists.","Use a flavor/version that matches the installed registry key names.","Run browsh elevated (if the key requires higher read access) or run a 64-bit-matching build."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// PowerShell check before running browsh\nGet-ItemProperty 'HKLM:\\Software\\Mozilla\\Firefox\\*\\Main' -Name PathToExe -ErrorAction SilentlyContinue","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install Firefox machine-wide with the official installer, not the per-user stub.","Verify the HKLM\\Software\\Mozilla key exists in regedit before running browsh.","Keep browsh and Firefox bitness (32/64-bit) matched.","Avoid registry cleaners that strip Mozilla keys."],"tags":["windows","registry","firefox-detection"],"backgroundTag":"registry-key-not-found","analyzedSha":"499ef386d45cd1e2b5457dd04887c017f77b7e27","analyzedAt":"2026-09-02T19:05:32.228Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}