{"record":{"id":"bcdb2d6fec1f0340","repo":"AlistGo/alist","slug":"missing-owner-qid-or-download-token-for-cookie-mod","errorCode":null,"errorMessage":"missing owner_qid or download_token for cookie mode","messagePattern":"missing owner_qid or download_token for cookie mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/yunpan360/util.go","lineNumber":456,"sourceCode":"\t}\n\tif ownerQID == \"\" && token != \"\" {\n\t\townerQID = ownerQIDFromToken(token)\n\t}\n\tif ownerQID != \"\" && token != \"\" {\n\t\td.cacheCookieDownloadSession(ownerQID, token)\n\t\treturn ownerQID, token, nil\n\t}\n\n\tpageSession, err := d.getCookieDownloadSessionFromPage(ctx)\n\tif err == nil && pageSession != nil {\n\t\townerQID = firstNonEmpty(ownerQID, pageSession.OwnerQID)\n\t\ttoken = firstNonEmpty(token, pageSession.Token)\n\t}\n\tif ownerQID == \"\" && token != \"\" {\n\t\townerQID = ownerQIDFromToken(token)\n\t}\n\tif ownerQID == \"\" || token == \"\" {\n\t\treturn \"\", \"\", errors.New(\"missing owner_qid or download_token for cookie mode\")\n\t}\n\n\td.cacheCookieDownloadSession(ownerQID, token)\n\treturn ownerQID, token, nil\n}\n\nfunc (d *Yunpan360) resolveCookieOwnerQID(ctx context.Context, file model.Obj, refresh bool) (string, error) {\n\townerQID := sanitizeOwnerQID(d.OwnerQID)\n\n\tif obj, ok := file.(*YunpanObject); ok {\n\t\townerQID = firstNonEmpty(sanitizeOwnerQID(obj.OwnerQID), ownerQID)\n\t}\n\n\townerQID = firstNonEmpty(ownerQID,\n\t\tsanitizeOwnerQID(getCookieValue(d.Cookie, \"owner_qid\")),\n\t\tsanitizeOwnerQID(getCookieValue(d.Cookie, \"ownerQid\")),\n\t\tsanitizeOwnerQID(getCookieValue(d.Cookie, \"qid\")),\n\t\tsanitizeOwnerQID(getCookieValue(d.Cookie, \"QID\")),","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/yunpan360/util.go#L438-L474","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fill the OwnerQID (and valid cookie) fields in the driver/storage configuration","Log in to yunpan360.com in a browser with the same cookie, open a file download once, then retry — this seeds the session state","Verify the cookie includes all domains/values the browser uses (copy the full cookie string)","If page markup changed (driver/website update), update the driver or clear the cached session and re-auth"],"exampleFix":"// before: storage config missing owner qid\naddition := {driver: \"Yunpan360\", cookie: \"...\"} // no owner_qid\n\n// after\naddition := {driver: \"Yunpan360\", cookie: \"...\", owner_qid: \"360100000012345678\"}","handlingStrategy":"fallback","validationCode":"if sanitizeOwnerQID(d.OwnerQID) == \"\" && d.cachedCookieSession == nil { /* expect page scrape; check cookie validity first */ }","typeGuard":"func hasDownloadParams(ownerQID, token string) bool { return ownerQID != \"\" && token != \"\" }","tryCatchPattern":"ownerQID, token, err := d.resolveCookieDownloadParams(ctx, file, refresh)\nif err != nil {\n    if strings.Contains(err.Error(), \"owner_qid\") {\n        // surface config guidance instead of retrying\n        return nil, fmt.Errorf(\"%w: set OwnerQID in storage config\", err)\n    }\n    return nil, err\n}","preventionTips":["Configure OwnerQID at storage setup time","Copy the complete cookie string from a working browser session","Seed the download session once via the web UI after changing cookies"],"tags":["yunpan360","download","cookie","scraping","config"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}