AlistGo/alist · error

failed to login into qBittorrent webui with url: {url}

Error message

failed to login into qBittorrent webui with url: {url}

What it means

The qBittorrent client's login POST to /api/v2/auth/login returned a 2-byte body that is not "Ok". qBittorrent answers 'Ok.' on success and 'Fails.' on bad credentials; anything other than the leading "Ok" triggers this error, which includes the configured WebUI url.

Source

Thrown at pkg/qbittorrent/client.go:93

func (c *client) login() error {
	// prepare HTTP request
	v := url.Values{}
	v.Set("username", c.url.User.Username())
	passwd, _ := c.url.User.Password()
	v.Set("password", passwd)
	resp, err := c.post("/api/v2/auth/login", v)
	if err != nil {
		return err
	}

	// check result
	body := make([]byte, 2)
	_, err = resp.Body.Read(body)
	if err != nil {
		return err
	}
	if string(body) != "Ok" {
		return errors.New("failed to login into qBittorrent webui with url: " + c.url.String())
	}
	return nil
}

func (c *client) post(path string, data url.Values) (*http.Response, error) {
	u := c.url.JoinPath(path)
	u.User = nil // remove userinfo for requests

	req, err := http.NewRequest("POST", u.String(), bytes.NewReader([]byte(data.Encode())))
	if err != nil {
		return nil, err
	}
	if data != nil {
		req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
	}

	resp, err := c.client.Do(req)
	if err != nil {

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Re-enter the exact WebUI username/password in the alist qBittorrent settings
  2. Confirm the URL targets the WebUI port (default 8080), not the listening torrent port
  3. Open the same URL in a browser and log in manually to confirm credentials work, then retry

Example fix

# before
url: http://192.168.1.10:8080
username: admin
password: old-password

# after
url: http://192.168.1.10:8080
username: admin
password: new-password
Defensive patterns

Strategy: retry

Try / catch

err := c.login()
if err != nil && strings.Contains(err.Error(), "failed to login into qBittorrent webui") {
	err = c.login() // one retry in case of transient WebUI restart
	if err != nil { return fmt.Errorf("qBittorrent credentials rejected: %w", err) }
}

Prevention

When it happens

Trigger: client.login() with wrong username/password (body "Fails."), or a URL that points at a non-qBittorrent HTTP service whose response body differs.

Common situations: Password changed in qBittorrent but not in alist settings; URL points to qBittorrent's torrent port instead of the WebUI port; special characters in the password not URL-encoded properly.

Related errors


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