{"record":{"id":"8a2b060014d663b1","repo":"AlistGo/alist","slug":"unauthorized-qbittorrent-url","errorCode":null,"errorMessage":"unauthorized qbittorrent url","messagePattern":"unauthorized qbittorrent url","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/qbittorrent/client.go","lineNumber":64,"sourceCode":"\t}\n\treturn c, nil\n}\n\nfunc (c *client) checkAuthorization() error {\n\t// check authorization\n\tif c.authorized() {\n\t\treturn nil\n\t}\n\n\t// check authorization after logging in\n\terr := c.login()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.authorized() {\n\t\treturn nil\n\t}\n\treturn errors.New(\"unauthorized qbittorrent url\")\n}\n\nfunc (c *client) authorized() bool {\n\tresp, err := c.post(\"/api/v2/app/version\", nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn resp.StatusCode == 200 // the status code will be 403 if not authorized\n}\n\nfunc (c *client) login() error {\n\t// prepare HTTP request\n\tv := url.Values{}\n\tv.Set(\"username\", c.url.User.Username())\n\tpasswd, _ := c.url.User.Password()\n\tv.Set(\"password\", passwd)\n\tresp, err := c.post(\"/api/v2/auth/login\", v)\n\tif err != nil {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/pkg/qbittorrent/client.go#L46-L82","documentation":"Returned by the qBittorrent offline-download client when, after a login attempt, a probe POST to /api/v2/app/version still does not return 200. It means the stored credentials/url combination never reaches an authorized state.","triggerScenarios":"Calling client.Login() (or the first operation that triggers it) with a wrong url, invalid username/password, or when qBittorrent's WebUI blocks the host (banned IP after failed attempts or CSRF/Referer restrictions).","commonSituations":"Wrong username/password in the alist qBittorrent offline-download settings, WebUI bypass list not including the alist server IP, qBittorrent behind a reverse path that strips cookies, or the server banning the client after repeated bad logins.","solutions":["Verify the qBittorrent WebUI URL, username and password in the storage/offline-download config","Whitelist the alist server in qBittorrent's WebUI 'bypass authentication for clients on localhost/subnet' or fix the ban (restart qBittorrent or wait out the ban) after too many failed attempts","Confirm cookies are being kept between login and probe requests (same http.Client with cookie jar) and that the URL scheme/port is correct"],"exampleFix":"# before (config)\nurl: http://192.168.1.10:8080\nusername: admin\npassword: wrongpass\n\n# after\nurl: http://192.168.1.10:8080\nusername: admin\npassword: correctpass\n# and in qBittorrent WebUI settings, allow the alist host subnet","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := c.Login()\nif err != nil && strings.Contains(err.Error(), \"unauthorized qbittorrent url\") {\n\t// fix config, ensure IP not banned, then retry once after re-login\n\treturn fmt.Errorf(\"qBittorrent auth failed: check url/credentials and WebUI bypass list: %w\", err)\n}","preventionTips":["Store verified credentials and test the login once at config time","Add the alist server IP to qBittorrent's auth-bypass subnet list","Avoid rapid failed logins that trigger qBittorrent's IP ban"],"tags":["qbittorrent","auth","offline-download","network"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}