multica-ai/multica · error

GitHub API returned %d

Error message

GitHub API returned %d

What it means

fetchReleaseByTag called GET https://api.github.com/repos/multica-ai/multica/releases/tags/<tag> and got a non-200 response. The status code is in the message: 404 means no release with that tag, 403/429 mean GitHub API rate limiting (60 req/h unauthenticated), 401 means bad credentials if a token was attached.

Source

Thrown at server/internal/cli/update.go:242

	return nil
}

func fetchReleaseByTag(tag string) (*GitHubRelease, error) {
	client := &http.Client{Timeout: 10 * time.Second}
	req, err := http.NewRequest(http.MethodGet, "https://api.github.com/repos/multica-ai/multica/releases/tags/"+tag, nil)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Accept", "application/vnd.github+json")

	resp, err := client.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("GitHub API returned %d", resp.StatusCode)
	}

	var release GitHubRelease
	if err := json.NewDecoder(resp.Body).Decode(&release); err != nil {
		return nil, err
	}
	return &release, nil
}

// FetchLatestRelease fetches the latest release tag from the multica GitHub repo.
func FetchLatestRelease() (*GitHubRelease, error) {
	client := &http.Client{Timeout: 10 * time.Second}
	req, err := http.NewRequest(http.MethodGet, "https://api.github.com/repos/multica-ai/multica/releases/latest", nil)
	if err != nil {
		return nil, err
	}
	req.Header.Set("Accept", "application/vnd.github+json")

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. If 404: verify the exact tag exists on the releases page (mind the leading 'v')
  2. If 403/429: set GITHUB_TOKEN (or the repo's configured token) to raise the rate limit to 5000/h, and lengthen the poll interval
  3. If 5xx: check githubstatus.com and retry later
  4. Cache the latest-release result so each machine does not hit the API on every poll

Example fix

# before: unauthenticated polling hits the 60 req/h limit
$ multica update check
GitHub API returned 403

# after
$ export GITHUB_TOKEN=ghp_xxx
$ multica update check
Defensive patterns

Strategy: retry

Validate before calling

if token := os.Getenv("GITHUB_TOKEN"); token == "" {
	// unauthenticated GitHub API is limited to 60 req/h; set a token for pollers
}

Try / catch

rel, err := cli.FetchReleaseByTag(tag) // or equivalent
if err != nil {
	if strings.Contains(err.Error(), "GitHub API returned 404") {
		// tag does not exist; correct the version string
	} else if strings.Contains(err.Error(), "403") || strings.Contains(err.Error(), "429") {
		// rate limited: back off and retry with a token
	}
}

Prevention

When it happens

Trigger: Requesting a release tag that does not exist (typo, 'v' prefix mismatch, draft release invisible to unauthenticated calls), exhausting the unauthenticated rate limit from repeated update polls, or GitHub incidents returning 5xx.

Common situations: Auto-update pollers on many machines sharing one NAT IP burning the 60/h anonymous quota; specifying version '1.2.3' when the tag is 'v1.2.3'; drafts/pre-releases not matching the tags endpoint.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/b580edb160485664. Report an issue: GitHub.