{"record":{"id":"55df122a80fc8b63","repo":"jesseduffield/lazygit","slug":"failed-to-open-url-s-error-v","errorCode":null,"errorMessage":"Failed to open URL %s\n\nError: %v","messagePattern":"Failed to open URL (.+?)\n\nError: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/gui.go","lineNumber":420,"sourceCode":"\n\tgui.g.SetOpenHyperlinkFunc(func(url string, viewname string) error {\n\t\tif strings.HasPrefix(url, \"lazygit-edit:\") {\n\t\t\tre := regexp.MustCompile(`^lazygit-edit://(.+?)(?::(\\d*))?$`)\n\t\t\tmatches := re.FindStringSubmatch(url)\n\t\t\tif matches == nil {\n\t\t\t\treturn fmt.Errorf(gui.Tr.InvalidLazygitEditURL, url)\n\t\t\t}\n\t\t\tfilepath := matches[1]\n\t\t\tif matches[2] != \"\" {\n\t\t\t\tlineNumber := utils.MustConvertToInt(matches[2])\n\t\t\t\tlineNumber = gui.helpers.Diff.AdjustLineNumber(filepath, lineNumber, viewname)\n\t\t\t\treturn gui.helpers.Files.EditFileAtLine(filepath, lineNumber)\n\t\t\t}\n\t\t\treturn gui.helpers.Files.EditFiles([]string{filepath})\n\t\t}\n\n\t\tif err := gui.os.OpenLink(url); err != nil {\n\t\t\treturn fmt.Errorf(gui.Tr.FailedToOpenURL, url, err)\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tgui.g.SetUpdateQueueHighWaterMarkHandler(func(depth int) {\n\t\tgui.c.Log.Infof(\"User-event queue reached a new high-water mark: %d\", depth)\n\t})\n\n\tgui.g.SetOnSelectSearchResultFunc(func(v *gocui.View, selectedLineIdx int) {\n\t\tctx, ok := gui.helpers.View.ContextForView(v.Name())\n\t\tif ok {\n\t\t\tif searchableContext, ok := ctx.(types.ISearchableContext); ok {\n\t\t\t\tsearchableContext.OnSearchSelect(selectedLineIdx)\n\t\t\t}\n\t\t}\n\t})\n","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/gui.go#L402-L438","documentation":"Thrown when lazygit's hyperlink handler delegates a non-lazygit-edit URL to the OS via gui.os.OpenLink and the opener fails. OpenLink shells out to the platform-specific opener (xdg-open on Linux, 'open' on macOS, cmd start on Windows), so failure means the opener binary is missing, refuses the URL, or the URL is not openable by it.","triggerScenarios":"Clicking any http/https (or other non-lazygit-edit) link in a lazygit view while xdg-open is absent or no default browser is configured on Linux; OpenLink receiving a URL with a scheme no handler is registered for.","commonSituations":"Minimal Linux setups (sway/i3/headless/WSL without wslview) with no xdg-open or no default browser; SSH sessions without URL forwarding; a URL scheme (e.g. 'mailto:') with no registered handler.","solutions":["On Linux ensure xdg-open exists (xdg-utils package) and a default browser is set via xdg-settings set default-web-browser","Set the BROWSER or similar environment variable lazygit's opener honors, or configure the opener in lazygit settings (os.openLink / guessEditor-style config)","On WSL install/dispatch wslview so opener invocations reach the Windows browser"],"exampleFix":"# before: no default browser\nxdg-open https://example.com  # fails\n\n# after\nsudo apt install xdg-utils\nxdg-settings set default-web-browser firefox.desktop","handlingStrategy":"retry","validationCode":"# Linux: verify an opener exists before relying on link clicks\ncommand -v xdg-open >/dev/null && xdg-settings get default-web-browser","typeGuard":null,"tryCatchPattern":"Catch the error surfaced by the hyperlink handler, log the failing URL, and fall back to copying the URL to the clipboard or printing it for manual opening rather than failing silently.","preventionTips":["Install xdg-utils and set a default browser on Linux before using link clicks","On WSL/SSH set BROWSER (or wslview) so the opener has something to dispatch to"],"tags":["lazygit","browser","xdg-open","linux","hyperlink"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}