chenhg5/cc-connect · error
gitee API returned HTTP %d
Error message
gitee API returned HTTP %d
What it means
fetchLatestStableFromGitee calls the Gitee releases API and requires exactly HTTP 200 (unlike the 2xx-range check elsewhere). Any other status — 404 for a missing repo, 403 rate limit, 5xx server error — yields this error naming the status code. The caller is the update checker looking for the latest stable release.
Source
Thrown at cmd/cc-connect/update.go:77
cachedLatestVersion.timestamp = time.Now()
cachedLatestVersion.mu.Unlock()
}()
}
// fetchLatestStableFromGitee 从Gitee获取最新稳定版本
func fetchLatestStableFromGitee() (*githubRelease, error) {
client := &http.Client{Timeout: 3 * time.Second}
req, _ := http.NewRequest("GET", giteeAPI, nil)
req.Header.Set("Accept", "application/json")
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
return nil, fmt.Errorf("gitee API returned HTTP %d", resp.StatusCode)
}
var release githubRelease
if err := json.NewDecoder(resp.Body).Decode(&release); err != nil {
return nil, err
}
// Gitee的latest通常就是稳定版,但检查Prerelease以防万一
if release.Prerelease {
return nil, nil
}
return &release, nil
}
// checkUpdateAsync 启动异步版本检查(不阻塞)
func checkUpdateAsync() {
// dev版本不检查
if version == "dev" || version == "" {
returnView on GitHub (pinned to 4000b2338a)
Solutions
- Verify the Gitee API URL (owner/repo) still resolves: curl -i the endpoint
- Retry later on 5xx or 403 rate-limit responses
- Provide an API token if rate-limited or repo is private
- Check whether the repo moved and update the hardcoded API path
Example fix
// before
if resp.StatusCode != 200 {
return nil, fmt.Errorf("gitee API returned HTTP %d", resp.StatusCode)
}
// after
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("gitee API returned HTTP %d: %s", resp.StatusCode, resp.Status)
} Defensive patterns
Strategy: retry
Validate before calling
resp, err := http.Get(giteeAPIURL)
if err == nil && resp.StatusCode != 200 {
return fmt.Errorf("gitee endpoint unhealthy: %d", resp.StatusCode)
} Type guard
func isOK(code int) bool { return code == 200 } Try / catch
rel, err := fetchLatestStableFromGitee(url)
if err != nil {
slog.Warn("update check failed, keeping current version", "err", err)
return nil // non-fatal for update checks
} Prevention
- Cache last-known release so transient API failures don't break updates
- Back off and retry on 403/5xx
- Pin the API URL and update it when the repo moves
- Send an API token to avoid rate limits
When it happens
Trigger: Gitee API response with StatusCode != 200: wrong owner/repo path in the API URL, unauthenticated 403 from rate limiting, 404 after repo rename, transient 502/503.
Common situations: Repo renamed or made private; Gitee API rate limits without a token; network middleware returning HTML error pages with non-200 codes; Gitee outage.
Related errors
- usage endpoint returned status %d: %s
- reasonix: POST %s returned %d: %s
- http %d: %s
- whisper API %d: %s
- qwen tts API %d: %s
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/add20808701302b2.
Report an issue: GitHub.