{"record":{"id":"fe672a3731dc502a","repo":"chenhg5/cc-connect","slug":"no-release-found","errorCode":null,"errorMessage":"no release found","messagePattern":"no release found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/update.go","lineNumber":278,"sourceCode":"\t}\n\n\t// Fallback: follow redirect from /releases/latest to extract tag\n\tlatestURL := \"https://github.com/\" + githubRepo + \"/releases/latest\"\n\tnoRedirect := &http.Client{\n\t\tTimeout: 15 * time.Second,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\tresp2, err := noRedirect.Get(latestURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"request failed: %w\", err)\n\t}\n\tdefer resp2.Body.Close()\n\n\tloc := resp2.Header.Get(\"Location\")\n\tif loc == \"\" {\n\t\treturn nil, fmt.Errorf(\"no release found\")\n\t}\n\tparts := strings.Split(loc, \"/tag/\")\n\tif len(parts) != 2 {\n\t\treturn nil, fmt.Errorf(\"unexpected redirect: %s\", loc)\n\t}\n\treturn &githubRelease{TagName: parts[1], HTMLURL: loc}, nil\n}\n\nfunc binaryAssetName(tag string) string {\n\tgoos := runtime.GOOS\n\tgoarch := runtime.GOARCH\n\tname := fmt.Sprintf(\"cc-connect-%s-%s-%s\", tag, goos, goarch)\n\tif goos == \"windows\" {\n\t\tname += \".exe\"\n\t}\n\treturn name\n}\n","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/update.go#L260-L296","documentation":"fetchLatestStableRelease discovers the latest stable version purely from the Location header of a 302 redirect (redirects are disabled). This error means the redirect response carried no Location header, so the latest tag could not be determined.","triggerScenarios":"resp2.Header.Get(\"Location\") is \"\": the server answered without a redirect (e.g. 200 page or 404 instead of 302), typically because /releases/latest has nothing to redirect to.","commonSituations":"Repository has no published releases (GitHub returns 404 without Location); a transparent proxy strips or rewrites the 302; repo is private and returns 404 without credentials; GitHub endpoint behavior differs from expected.","solutions":["Confirm the repo has at least one published release (a 404 from /releases/latest means zero releases)","Bypass any intercepting proxy that may strip Location headers (test with curl -v and look for the 302 + Location line)","Fall back to the /releases list endpoint (fetchLatestPreRelease path) which returns tags in the JSON body instead of headers","Check repo visibility/token — a private repo without credentials yields no redirect"],"exampleFix":"// before\nloc := resp2.Header.Get(\"Location\")\nif loc == \"\" {\n    return nil, fmt.Errorf(\"no release found\")\n}\n// after\nloc := resp2.Header.Get(\"Location\")\nif loc == \"\" {\n    return nil, fmt.Errorf(\"no release found (HTTP %d, no Location header)\", resp2.StatusCode)\n}","handlingStrategy":"fallback","validationCode":"// check the latest-release URL returns a 302 with Location before parsing:\nclient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}\nresp, err := client.Get(\"https://github.com/<owner>/<repo>/releases/latest\")\nif err == nil && resp.StatusCode == 404 {\n    return errors.New(\"repo has no latest release (404)\")\n}","typeGuard":null,"tryCatchPattern":"// Go: fall back to the releases list endpoint when the redirect probe fails\nrel, err := fetchLatestStableRelease()\nif err != nil {\n    if strings.Contains(err.Error(), \"no release found\") {\n        rel, err = fetchLatestPreRelease() // JSON body carries the tag\n    }\n    if err != nil { return err }\n}","preventionTips":["Don't rely solely on header-based version discovery; prefer the JSON API's tag_name","Check repo visibility and credentials — private repos 404 without auth","Test through the same proxy/VPN the production host uses","Log response status alongside the missing header for faster diagnosis"],"tags":["http","redirect","github-api","update-checker","empty-response"],"backgroundTag":"unexpected-response-shape","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}