AlistGo/alist · error

missing owner_qid or download_token for cookie mode

Error message

missing owner_qid or download_token for cookie mode

What it means

resolveCookieDownloadParams could not assemble the pair (owner_qid, download_token) required by the cookie download endpoint, even after consulting the cached session, the HTML index page, and deriving ownerQID from the token (drivers/yunpan360/util.go:456). Without both values the download form cannot be signed.

Source

Thrown at drivers/yunpan360/util.go:456

	}
	if ownerQID == "" && token != "" {
		ownerQID = ownerQIDFromToken(token)
	}
	if ownerQID != "" && token != "" {
		d.cacheCookieDownloadSession(ownerQID, token)
		return ownerQID, token, nil
	}

	pageSession, err := d.getCookieDownloadSessionFromPage(ctx)
	if err == nil && pageSession != nil {
		ownerQID = firstNonEmpty(ownerQID, pageSession.OwnerQID)
		token = firstNonEmpty(token, pageSession.Token)
	}
	if ownerQID == "" && token != "" {
		ownerQID = ownerQIDFromToken(token)
	}
	if ownerQID == "" || token == "" {
		return "", "", errors.New("missing owner_qid or download_token for cookie mode")
	}

	d.cacheCookieDownloadSession(ownerQID, token)
	return ownerQID, token, nil
}

func (d *Yunpan360) resolveCookieOwnerQID(ctx context.Context, file model.Obj, refresh bool) (string, error) {
	ownerQID := sanitizeOwnerQID(d.OwnerQID)

	if obj, ok := file.(*YunpanObject); ok {
		ownerQID = firstNonEmpty(sanitizeOwnerQID(obj.OwnerQID), ownerQID)
	}

	ownerQID = firstNonEmpty(ownerQID,
		sanitizeOwnerQID(getCookieValue(d.Cookie, "owner_qid")),
		sanitizeOwnerQID(getCookieValue(d.Cookie, "ownerQid")),
		sanitizeOwnerQID(getCookieValue(d.Cookie, "qid")),
		sanitizeOwnerQID(getCookieValue(d.Cookie, "QID")),

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Fill the OwnerQID (and valid cookie) fields in the driver/storage configuration
  2. Log in to yunpan360.com in a browser with the same cookie, open a file download once, then retry — this seeds the session state
  3. Verify the cookie includes all domains/values the browser uses (copy the full cookie string)
  4. If page markup changed (driver/website update), update the driver or clear the cached session and re-auth

Example fix

// before: storage config missing owner qid
addition := {driver: "Yunpan360", cookie: "..."} // no owner_qid

// after
addition := {driver: "Yunpan360", cookie: "...", owner_qid: "360100000012345678"}
Defensive patterns

Strategy: fallback

Validate before calling

if sanitizeOwnerQID(d.OwnerQID) == "" && d.cachedCookieSession == nil { /* expect page scrape; check cookie validity first */ }

Type guard

func hasDownloadParams(ownerQID, token string) bool { return ownerQID != "" && token != "" }

Try / catch

ownerQID, token, err := d.resolveCookieDownloadParams(ctx, file, refresh)
if err != nil {
    if strings.Contains(err.Error(), "owner_qid") {
        // surface config guidance instead of retrying
        return nil, fmt.Errorf("%w: set OwnerQID in storage config", err)
    }
    return nil, err
}

Prevention

When it happens

Trigger: cookieDownloadURL path where: d.OwnerQID config is empty/invalid, the file object carries no OwnerQID, no cached session exists, and scraping the index page failed to yield a session (or yielded only one of the two values). Triggered by any Link() call in cookie mode.

Common situations: Storage created without OwnerQID filled in and the 360 web page layout changed so page scraping breaks; cookie valid for API but the download session page requires extra state; accounts where the download token is only issued after visiting the share/download UI in a browser.

Related errors


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