router-for-me/CLIProxyAPI · error

redirect missing Location header

Error message

redirect missing Location header

What it means

pluginStoreRedirectURL extracts the next hop from a 3xx response. 'redirect missing Location header' means the response carried a redirect status (301/302/303/307/308) but its Location header was absent or whitespace-only after TrimSpace. The manual redirect follower cannot proceed without a target.

Source

Thrown at internal/pluginstore/github.go:246

	clone.CheckRedirect = func(*http.Request, []*http.Request) error {
		return http.ErrUseLastResponse
	}
	return &clone
}

func pluginStoreRedirectStatus(status int) bool {
	switch status {
	case http.StatusMovedPermanently, http.StatusFound, http.StatusSeeOther, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
		return true
	default:
		return false
	}
}

func pluginStoreRedirectURL(resp *http.Response, requestURL string) (string, error) {
	location := strings.TrimSpace(resp.Header.Get("Location"))
	if location == "" {
		return "", fmt.Errorf("redirect missing Location header")
	}
	base, errBase := url.Parse(requestURL)
	if errBase != nil {
		return "", fmt.Errorf("parse redirect base: %w", errBase)
	}
	next, errNext := base.Parse(location)
	if errNext != nil {
		return "", fmt.Errorf("parse redirect location: %w", errNext)
	}
	if next.Scheme == "" || next.Host == "" {
		return "", fmt.Errorf("redirect location is not absolute")
	}
	return next.String(), nil
}

func readPluginStoreResponse(resp *http.Response, maxSize int64, authenticated bool) ([]byte, error) {
	defer func() {
		if errClose := resp.Body.Close(); errClose != nil {

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Reproduce with curl -I against the URL and inspect the 3xx response headers to confirm Location is truly missing.
  2. Fix or report the server/proxy that emits redirect statuses without a Location header.
  3. Bypass the broken hop by pinning the final artifact URL in the plugin manifest.
Defensive patterns

Strategy: validation

Try / catch

if err := fetch(); err != nil {
    if strings.Contains(err.Error(), "redirect missing Location") {
        // server bug: log the hop URL and pin a direct artifact URL instead of retrying blindly
    }
}

Prevention

When it happens

Trigger: Any followed 3xx whose headers lack Location — misconfigured servers, some load balancers returning 302 with the target in a custom header, or empty-header edge cases from certain CDNs.

Common situations: A reverse proxy or auth middleware issuing a 302 without Location; a health/maintenance page returned as 302 with no target; unusual GitHub Enterprise configurations.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/b3a44fee623ef864. Report an issue: GitHub.