{"record":{"id":"7a609aff59ef292c","repo":"jesseduffield/lazygit","slug":"invalid-lazygit-edit-url-format-s","errorCode":null,"errorMessage":"Invalid lazygit-edit URL format: %s","messagePattern":"Invalid lazygit-edit URL format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gui/gui.go","lineNumber":408,"sourceCode":"\t\t\t\tif err := gui.checkForChangedConfigsThatDontAutoReload(oldConfig, gui.Config.GetUserConfig()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tgui.c.Log.Info(\"Receiving focus - refreshing\")\n\t\t\tgui.helpers.Refresh.Refresh(types.RefreshOptions{DontBlockRepoSwitch: true})\n\t\t\treturn reloadErr\n\t\t}\n\n\t\treturn nil\n\t})\n\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) {","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/gui.go#L390-L426","documentation":"Thrown by lazygit's open-hyperlink handler (SetOpenHyperlinkFunc in pkg/gui/gui.go) when a clicked link starts with the 'lazygit-edit:' scheme but does not match the expected shape 'lazygit-edit://<filepath>' or 'lazygit-edit://<filepath>:<line>'. The regex '^lazygit-edit://(.+?)(?::(\\d*))?$' requires the '//' authority separator and an optional all-digit line number. Any deviation (missing slashes, non-numeric line suffix, trailing colon with junk) makes FindStringSubmatch return nil and this error fires.","triggerScenarios":"Clicking a hyperlink rendered in any gocui view whose URL begins with 'lazygit-edit:' but is malformed, e.g. 'lazygit-edit:file.go' (no '//'), 'lazygit-edit://file.go:abc' (non-numeric line), or 'lazygit-edit://file.go:12:' (extra trailing segment). Emitted by custom command output, commit messages, or any text lazygit renders as a link.","commonSituations":"A user config or custom command templates a lazygit-edit link with a bad format string; a plugin/script writes an edit link missing the '//' separator; a template inserts an empty or non-numeric line number producing ':abc' or ':'.","solutions":["Fix the URL emitter to use exactly 'lazygit-edit://<path>' or 'lazygit-edit://<path>:<integer line>'","If the link comes from a custom command template, check its output formatting for the lazygit-edit scheme","If the link is supposed to be a normal web URL, remove the 'lazygit-edit:' prefix so it is handed to the OS opener instead"],"exampleFix":"// before (bad link producer)\nfmt.Sprintf(\"lazygit-edit:%s:%d\", path, line)\n\n// after\nfmt.Sprintf(\"lazygit-edit://%s:%d\", path, line)","handlingStrategy":"validation","validationCode":"var lazygitEditRe = regexp.MustCompile(`^lazygit-edit://(.+?)(?::(\\d*))?$`)\n\nfunc validLazygitEditURL(url string) bool {\n    return !strings.HasPrefix(url, \"lazygit-edit:\") || lazygitEditRe.MatchString(url)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always format edit links as lazygit-edit://<path> or lazygit-edit://<path>:<line> with a numeric line","Test link-emitting templates once after writing them by clicking the link in lazygit"],"tags":["lazygit","hyperlink","url-format","editor-integration"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}