{"record":{"id":"28a8753e7782e002","repo":"AlistGo/alist","slug":"missing-cookie-or-qrcode-account-28a875","errorCode":null,"errorMessage":"missing cookie or qrcode account","messagePattern":"missing cookie or qrcode account","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/115_share/utils.go","lineNumber":200,"sourceCode":"\t\treturn errors.Wrap(err, \"failed to get share snap\")\n\t}\n\tcr := &driver115.Credential{}\n\tif d.QRCodeToken != \"\" {\n\t\ts := &driver115.QRCodeSession{\n\t\t\tUID: d.QRCodeToken,\n\t\t}\n\t\tif cr, err = d.client.QRCodeLoginWithApp(s, driver115.LoginApp(d.QRCodeSource)); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to login by qrcode\")\n\t\t}\n\t\td.Cookie = fmt.Sprintf(\"UID=%s;CID=%s;SEID=%s;KID=%s\", cr.UID, cr.CID, cr.SEID, cr.KID)\n\t\td.QRCodeToken = \"\"\n\t} else if d.Cookie != \"\" {\n\t\tif err = cr.FromCookie(d.Cookie); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to login by cookies\")\n\t\t}\n\t\td.client.ImportCredential(cr)\n\t} else {\n\t\treturn errors.New(\"missing cookie or qrcode account\")\n\t}\n\n\treturn d.client.LoginCheck()\n}\n","sourceCodeStart":182,"sourceCodeEnd":205,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/115_share/utils.go#L182-L205","documentation":"Returned by the strm driver's link reader (drivers/strm/util.go:246) when a link has no readable source at all: link.MFile is nil, link.RangeReadCloser is nil, and link.URL is the empty string. It means the .strm resolution produced a Link with no content source, so there is nothing to read or proxy.","triggerScenarios":"Opening/reading the raw content of an object whose resolved Link was built with only headers/flags (e.g. a metadata-only link) or where the URL extraction from the .strm file produced an empty string; passing a zero-value model.Link to this helper.","commonSituations":"A .strm file that contains only whitespace or no URL on its first line; a resolver path that returns &model.Link{} as a placeholder on failure instead of an error; upstream refactors of model.Link making MFile/RangeReadCloser nil where they used to be set.","solutions":["Check the source .strm file content — ensure the first line is a non-empty absolute URL.","Audit the code path that builds the Link: on extraction failure return an error instead of an empty Link.","Before reading, guard: if link.MFile == nil && link.RangeReadCloser == nil && link.URL is empty, treat it as an invalid/missing source and surface a user-facing error."],"exampleFix":"// before\nreturn &model.Link{}, nil // resolver placeholder -> later \"empty link\"\n\n// after\nif rawURL == \"\" {\n\treturn nil, fmt.Errorf(\"strm file %s has no link\", path)\n}\nreturn &model.Link{URL: rawURL}, nil","handlingStrategy":"validation","validationCode":"if link.MFile == nil && link.RangeReadCloser == nil && strings.TrimSpace(link.URL) == \"\" {\n\treturn nil, fmt.Errorf(\"strm target has no content source\")\n}","typeGuard":"func hasReadableSource(link *model.Link) bool {\n\treturn link != nil && (link.MFile != nil || link.RangeReadCloser != nil || strings.TrimSpace(link.URL) != \"\")\n}","tryCatchPattern":"if _, err := readStrmLink(ctx, link); err != nil && err.Error() == \"empty link\" {\n\t// treat as corrupt strm file; surface the file path\n}","preventionTips":["Never return placeholder zero-value Links from resolvers; return errors.","Validate .strm files at creation: first line must be a non-empty URL.","Guard MFile/RangeReadCloser/URL before reading."],"tags":["strm","link","missing-data","content"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}