flipped-aurora/gin-vue-admin · error

读取下载结果失败: %w

Error message

读取下载结果失败: %w

What it means

Reading the marketplace response body with io.ReadAll failed. The connection was established and returned 200, but the body could not be fully read — typically a dropped/reset connection mid-transfer or a read timeout.

Source

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

	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 == "" {
		return errors.New("下载结果缺少 url")
	}

	zipResp, err := http.Get(realDownloadURL)
	if err != nil {

View on GitHub (pinned to 3136500ef3)

Solutions

  1. Simply retry the download — this is usually transient
  2. Check for proxy/LB timeouts between the server and the marketplace
  3. Stabilize the network path (keepalive settings, MTU issues on VPN tunnels)
  4. Inspect the wrapped error: 'unexpected EOF' or 'connection reset by peer' indicates mid-body disconnect
Defensive patterns

Strategy: retry

Try / catch

if err := DownloadOnlineSkill(ctx, req); err != nil && strings.Contains(err.Error(), "读取下载结果失败") {
    // body read interrupted; retry the download, it is transient
}

Prevention

When it happens

Trigger: Calling DownloadOnlineSkill when the marketplace (or an intermediary proxy/LB) closes the TCP connection before the full JSON body arrives, or the body is truncated by a network interruption.

Common situations: Flaky network between server and marketplace; aggressive proxy idle timeouts; very large responses interrupted by LB body limits.

Related errors


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