flipped-aurora/gin-vue-admin · error

下载技能失败, HTTP状态码: %d

Error message

下载技能失败, HTTP状态码: %d

What it means

The marketplace responded with a non-200 status to the downloadSkill POST. The code requires HTTP 200 before reading the body; any other status (404, 403, 500, 429...) yields this error carrying the status code.

Source

Thrown at server/service/system/sys_skills.go:415

	})
	if err != nil {
		return fmt.Errorf("构建下载请求失败: %w", err)
	}

	downloadReq, err := http.NewRequest(http.MethodPost, "https://plugin.gin-vue-admin.com/api/shopPlugin/downloadSkill", bytes.NewReader(body))
	if err != nil {
		return fmt.Errorf("构建下载请求失败: %w", err)
	}
	downloadReq.Header.Set("Content-Type", "application/json")

	downloadResp, err := http.DefaultClient.Do(downloadReq)
	if err != nil {
		return fmt.Errorf("下载技能失败: %w", err)
	}
	defer downloadResp.Body.Close()

	if downloadResp.StatusCode != http.StatusOK {
		return fmt.Errorf("下载技能失败, HTTP状态码: %d", downloadResp.StatusCode)
	}

	metaBody, err := io.ReadAll(downloadResp.Body)
	if err != nil {
		return fmt.Errorf("读取下载结果失败: %w", err)
	}

	var meta struct {
		Data struct {
			URL string `json:"url"`
		} `json:"data"`
	}
	if err = json.Unmarshal(metaBody, &meta); err != nil {
		return fmt.Errorf("解析下载结果失败: %w", err)
	}

	realDownloadURL := strings.TrimSpace(meta.Data.URL)
	if realDownloadURL == "" {

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Log the returned status code and read the response body for the marketplace's error message
  2. Verify the skill ID and version exist on the marketplace (check the plugin shop listing)
  3. Retry with backoff for 5xx/429; treat 4xx as a user-input problem
  4. Check whether a proxy/WAF in front of the marketplace is rejecting datacenter traffic
Defensive patterns

Strategy: retry

Type guard

func isMarketplaceStatusErr(err error) (int, bool) {
    m := regexp.MustCompile(`HTTP状态码: (\d+)`).FindStringSubmatch(err.Error())
    if len(m) < 2 { return 0, false }
    code, _ := strconv.Atoi(m[1])
    return code, true
}

Try / catch

if err := DownloadOnlineSkill(ctx, req); err != nil {
    if code, ok := isMarketplaceStatusErr(err); ok {
        switch {
        case code == 404: // invalid skill id/version — fix user input
        case code == 429 || code >= 500: // retry with backoff
        default: // surface marketplace message
        }
    }
}

Prevention

When it happens

Trigger: Calling DownloadOnlineSkill with an ID/version that doesn't exist (404), being rate-limited (429), marketplace auth/ACL rejection (403), or a marketplace-side error (5xx).

Common situations: Outdated client using a retired plugin_id; wrong version string; marketplace deployed behind a CDN/WAF that blocks datacenter IPs; marketplace maintenance window.

Related errors


AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31). Data as JSON: /api/errors/bfe027477ca4d42d. Report an issue: GitHub.