{"record":{"id":"874cd03e42727300","repo":"fish2018/pansou","slug":"login-required","errorCode":null,"errorMessage":"login required","messagePattern":"login required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"plugin/panlian/panlian.go","lineNumber":49,"sourceCode":"\t\"pansou/util/json\"\n)\n\nconst (\n\tPluginName        = \"panlian\"\n\tDisplayName       = \"盘链\"\n\tDescription       = \"盘链 - 登录后检索影视资源并聚合网盘链接\"\n\tDefaultBaseURL    = \"https://pinglian.lol\"\n\tConfigFileName    = \"panlian_config.json\"\n\tRequestTimeout    = 20 * time.Second\n\tMaxConcurrentJobs = 4\n\tMaxVideoResults   = 10\n\tMaxLinksPerResult = 200\n)\n\nvar (\n\tstorageDir string\n\n\terrLoginRequired = errors.New(\"login required\")\n\n\tpanOrder = map[string]int{\n\t\t\"quark\":   0,\n\t\t\"uc\":      1,\n\t\t\"baidu\":   2,\n\t\t\"xunlei\":  3,\n\t\t\"123\":     4,\n\t\t\"tianyi\":  5,\n\t\t\"115\":     6,\n\t\t\"aliyun\":  7,\n\t\t\"guangya\": 8,\n\t\t\"mobile\":  9,\n\t\t\"pikpak\":  10,\n\t\t\"magnet\":  11,\n\t\t\"others\":  12,\n\t}\n\n\textractCodeNoiseRegex = regexp.MustCompile(`(?i)([?？]?\\s*(提取码|访问码|密码)[:：]\\s*[a-z0-9]{4,8})+$`)","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/panlian/panlian.go#L31-L67","documentation":"errLoginRequired is a sentinel error (errors.New(\"login required\")) defined in plugin/panlian/panlian.go. It signals that the pan (net-disk) search backend requires an authenticated user session, allowing callers to distinguish 'login needed' from other failures. Code paths explicitly check it with errors.Is to stop retries or surface it to users.","triggerScenarios":"Calling searchWithUser (or the fan-out search at panlian.go:591/660) when no valid cookies/session exist, or after the pan provider has invalidated the session (expired cookies, kicked login, captcha challenge).","commonSituations":"Stale or missing stored cookies in storageDir after site password change; the remote pan site forcing re-login; running without configuring credentials; concurrent workers all failing with the same expired session.","solutions":["Re-authenticate: call the login flow (loginWithUser/login endpoint) to refresh cookies before retrying the search","Check errors.Is(err, errLoginRequired) and trigger the login UI/prompt instead of returning a generic failure","Verify stored cookie/session files under storageDir are present and not expired; delete stale ones and log in again","If the site changed its login endpoint/anti-bot behavior, update the plugin's login logic"],"exampleFix":"// before\nresults, err := searchWithUser(ctx, keyword)\nif err != nil { return nil, err }\n// after\nresults, err := searchWithUser(ctx, keyword)\nif errors.Is(err, errLoginRequired) {\n    if _, _, lerr := login(); lerr != nil { return nil, lerr }\n    results, err = searchWithUser(ctx, keyword)\n}\nif err != nil { return nil, err }","handlingStrategy":"try-catch","validationCode":"// Go\nif cookiesExpired(storedCookies) { triggerReLogin() }","typeGuard":null,"tryCatchPattern":"results, err := searchWithUser(ctx, kw)\nif errors.Is(err, errLoginRequired) {\n    // re-authenticate then retry, or surface 'please login' to user\n}","preventionTips":["Refresh cookies proactively before they expire","Check errors.Is(err, errLoginRequired) rather than string comparison","Persist and validate session state before each search batch"],"tags":["authentication","session-expired","sentinel-error","go"],"backgroundTag":"authentication-required","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}