MHSanaei/3x-ui · error

download panel updater: %w

Error message

download panel updater: %w

What it means

downloadPanelUpdater builds the GET request for the updater script URL; this branch wraps only http.NewRequestWithContext failing. With a constant, well-formed URL this practically cannot fire — it exists for completeness. If it ever does, the URL constant itself is malformed (parse error).

Source

Thrown at internal/web/service/panel/panel.go:361

// previousRunIsTerminal reports whether the run currently recorded in
// updateRunID has reached success or failure per its status file. Must be
// called with updateMu held.
func previousRunIsTerminal() bool {
	status := (&PanelService{}).GetUpdateStatus()
	return status.RunID == strconv.FormatInt(updateRunID, 10) && status.State != updateStatePending
}

func releaseUpdateSlot() {
	updateMu.Lock()
	updateRunning = false
	updateMu.Unlock()
}

func downloadPanelUpdater() (string, error) {
	client := (&service.SettingService{}).NewProxiedHTTPClient(15 * time.Second)
	req, reqErr := http.NewRequestWithContext(context.Background(), http.MethodGet, panelUpdaterURL, nil)
	if reqErr != nil {
		return "", fmt.Errorf("download panel updater: %w", reqErr)
	}
	resp, err := client.Do(req)
	if err != nil {
		return "", fmt.Errorf("download panel updater: %w", err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return "", fmt.Errorf("download panel updater: unexpected HTTP %d", resp.StatusCode)
	}

	file, err := os.CreateTemp("", "3x-ui-update-*.sh")
	if err != nil {
		return "", err
	}
	path := file.Name()
	ok := false
	defer func() {
		_ = file.Close()

View on GitHub (pinned to ad32144c42)

Solutions

  1. If you are building a modified panel, validate the panelUpdaterURL constant parses as an absolute https URL
  2. For end users: report upstream — this is not configuration-dependent
Defensive patterns

Strategy: validation

Validate before calling

if _, err := url.ParseRequestURI(panelUpdaterURL); err != nil {
    return fmt.Errorf("updater URL malformed: %w", err)
}

Prevention

When it happens

Trigger: Only if panelUpdaterURL in the source were corrupted (invalid characters, bad scheme) — not reachable through any user configuration.

Common situations: Essentially none in production; a developer editing panelUpdaterURL and introducing a typo would hit it in tests.

Related errors


AI-assisted analysis of MHSanaei/3x-ui@ad32144c42 (2026-08-15). Data as JSON: /api/errors/32a8e5a99c3ca68d. Report an issue: GitHub.