AlistGo/alist · warning

failed to delete qbittorrent tag

Error message

failed to delete qbittorrent tag

What it means

After successfully deleting a torrent, deleting its management tag via POST /api/v2/torrents/deleteTags returned non-200. Only tag cleanup failed; the torrent itself is already gone.

Source

Thrown at pkg/qbittorrent/client.go:363

	} else {
		v.Set("deleteFiles", "false")
	}
	response, err := c.post("/api/v2/torrents/delete", v)
	if err != nil {
		return err
	}
	if response.StatusCode != 200 {
		return errors.New("failed to delete qbittorrent task")
	}

	v = url.Values{}
	v.Set("tags", "alist-"+id)
	response, err = c.post("/api/v2/torrents/deleteTags", v)
	if err != nil {
		return err
	}
	if response.StatusCode != 200 {
		return errors.New("failed to delete qbittorrent tag")
	}
	return nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Treat tag-deletion failure as non-fatal: log it and return success for the overall delete (torrent removal already succeeded)
  2. Re-login and retry the deleteTags call once
  3. Periodically clean orphaned alist-* tags in qBittorrent if errors were swallowed

Example fix

// before
if response.StatusCode != 200 {
    return errors.New("failed to delete qbittorrent tag")
}

// after
if response.StatusCode != 200 {
    log.Warnf("failed to delete qbittorrent tag %s: status %d", "alist-"+id, response.StatusCode)
    return nil // torrent deleted; tag cleanup is best-effort
}
Defensive patterns

Strategy: fallback

Try / catch

err := c.DeleteTorrent(info, true, id)
if err != nil && strings.Contains(err.Error(), "failed to delete qbittorrent tag") {
	log.Warnf("tag cleanup failed for alist-%s; ignoring", id)
	return nil
}

Prevention

When it happens

Trigger: Calling DeleteTorrent when the session lost authorization between the two POSTs, or qBittorrent rejects the deleteTags call for the tag "alist-<id>".

Common situations: WebUI session expiry mid-delete; qBittorrent restart between calls; harmless leftover tags accumulate if this error is not tolerated.

Related errors


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