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
- Simply retry the download — this is usually transient
- Check for proxy/LB timeouts between the server and the marketplace
- Stabilize the network path (keepalive settings, MTU issues on VPN tunnels)
- 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
- Use an HTTP client with sane timeouts and keepalives
- Retry idempotent GET/POST downloads on read errors
- Investigate proxies/LBs with aggressive idle timeouts
- Prefer stable network paths for marketplace traffic
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
- 读取文件失败, err:
- 保存技能包失败: %w
- result.Msg
- 目标解析为内网/环回/链路本地地址, 已被 SSRF 防护拒绝(可在任务上开启"允许内网"豁免)
- function io.Copy() failed, err:
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/6d8627351d43f0fc.
Report an issue: GitHub.