{"record":{"id":"9e1e3bfaed5c6dc5","repo":"mislav/hub","slug":"no-valid-remote-urls","errorCode":null,"errorMessage":"No valid remote URLs","messagePattern":"No valid remote URLs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github/remote.go","lineNumber":89,"sourceCode":"\n\t// the rest of the remotes\n\tfor n, u := range remotesMap {\n\t\tr, err := newRemote(n, u)\n\t\tif err == nil {\n\t\t\tremotes = append(remotes, r)\n\t\t}\n\t}\n\n\treturn\n}\n\nfunc newRemote(name string, urlMap map[string]string) (Remote, error) {\n\tr := Remote{}\n\n\tfetchURL, ferr := git.ParseURL(urlMap[\"fetch\"])\n\tpushURL, perr := git.ParseURL(urlMap[\"push\"])\n\tif ferr != nil && perr != nil {\n\t\treturn r, fmt.Errorf(\"No valid remote URLs\")\n\t}\n\n\tr.Name = name\n\tif ferr == nil {\n\t\tr.URL = fetchURL\n\t}\n\tif perr == nil {\n\t\tr.PushURL = pushURL\n\t}\n\n\treturn r, nil\n}\n","sourceCodeStart":71,"sourceCodeEnd":102,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/remote.go#L71-L102","documentation":"newRemote builds a Remote from a name plus fetch/push URL strings. Both URLs are passed through git.ParseURL; if BOTH fail to parse, the remote has no usable URL and this error is returned. Remotes() skips such entries, so malformed remotes are silently dropped from the list.","triggerScenarios":"A remote entry in `git remote -v` whose URL string cannot be parsed by git.ParseURL — e.g. empty URL, unsupported scheme, or a malformed scp-like syntax (called from Remotes during loadRemotes).","commonSituations":"Remote added with an empty or whitespace URL; exotic schemes (e.g. custom helper:// remotes); scp-style URLs with unusual formatting like user@host::path; git config hand-edited with invalid URLs.","solutions":["Fix the malformed remote URL: git remote set-url <name> <valid-url> (e.g. https://github.com/owner/repo.git or git@github.com:owner/repo.git)","Inspect the raw entry: git remote -v and git config --get-regexp 'remote\\..*\\.url'","Remove broken remotes: git remote remove <name>, then re-add correctly","If using an exotic transport, ensure the URL matches formats git.ParseURL supports (https, ssh, git, scp-like)"],"exampleFix":"// before\ngit remote add origin \"\"\n// after\ngit remote remove origin\ngit remote add origin git@github.com:owner/repo.git","handlingStrategy":"validation","validationCode":"for _, u := range remoteURLs {\n    if u == \"\" { continue }\n    if _, err := url.Parse(u); err != nil { /* malformed remote URL */ }\n}","typeGuard":null,"tryCatchPattern":"remotes, err := github.Remotes()\nif err != nil {\n    if strings.Contains(err.Error(), \"No valid remote URLs\") {\n        return fmt.Errorf(\"a remote has an unparseable URL; run git remote -v and fix it with git remote set-url\")\n    }\n    return err\n}","preventionTips":["Never add remotes with empty or placeholder URLs","Use standard URL schemes: https://, ssh (git@host:path), or git://","Audit git config remote.*.url entries after hand-editing .git/config","Note Remotes() silently drops unparseable remotes — verify expected remotes appear in output"],"tags":["git","url-parsing","remote-configuration"],"backgroundTag":"invalid-git-remote-url","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}