AlistGo/alist · error

failed to execute rename request: %w

Error message

failed to execute rename request: %w

What it means

The raw http.Client (built with no Timeout: client := &http.Client{}) failed to complete the PUT rename request. This is a transport-level error: DNS failure, TCP connect failure, TLS handshake error, proxy refusal, or context cancellation — never an HTTP status.

Source

Thrown at drivers/proton_drive/util.go:652

		return fmt.Errorf("failed to marshal rename request: %w", err)
	}

	httpReq, err := http.NewRequestWithContext(ctx, "PUT", renameURL, bytes.NewReader(reqBody))
	if err != nil {
		return fmt.Errorf("failed to create HTTP request: %w", err)
	}

	httpReq.Header.Set("Content-Type", "application/json")
	httpReq.Header.Set("Accept", d.protonJson)
	httpReq.Header.Set("X-Pm-Appversion", d.webDriveAV)
	httpReq.Header.Set("X-Pm-Drive-Sdk-Version", d.sdkVersion)
	httpReq.Header.Set("X-Pm-Uid", d.credentials.UID)
	httpReq.Header.Set("Authorization", "Bearer "+d.credentials.AccessToken)

	client := &http.Client{}
	resp, err := client.Do(httpReq)
	if err != nil {
		return fmt.Errorf("failed to execute rename request: %w", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("rename failed with status %d", resp.StatusCode)
	}

	var renameResp RenameResponse
	if err := json.NewDecoder(resp.Body).Decode(&renameResp); err != nil {
		return fmt.Errorf("failed to decode rename response: %w", err)
	}

	if renameResp.Code != 1000 {
		return fmt.Errorf("rename failed with code %d", renameResp.Code)
	}

	return nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Retry once after a short delay — transient resets are common
  2. Check proxy env vars and network egress to the Proton API host
  3. Set a Timeout on the http.Client (or rely on ctx) so failures surface quickly instead of hanging
  4. If errors.Is(err, context.Canceled), report as user-abort, not as a fault

Example fix

// before
client := &http.Client{}
// after
client := &http.Client{Timeout: 60 * time.Second}
Defensive patterns

Strategy: retry

Try / catch

var netErr net.Error
if errors.As(err, &netErr) || errors.Is(err, context.DeadlineExceeded) {
    // transient transport failure: retry with backoff
} else if errors.Is(err, context.Canceled) {
    // user abort: do not retry
}

Prevention

When it happens

Trigger: No network route to api.proton.me, corporate proxy/MITM rejecting the TLS cert, ctx cancelled (user aborted the operation), or connection reset mid-request.

Common situations: Running the mount behind a restrictive firewall; captive portal; system proxy env vars (HTTP_PROXY/HTTPS_PROXY) pointing at a dead proxy; cancellation races when the UI aborts the rename.

Related errors


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/2d9630bca198bc2c. Report an issue: GitHub.