{"record":{"id":"d62f1bd64c925c96","repo":"AlistGo/alist","slug":"empty-captchatoken-d62f1b","errorCode":null,"errorMessage":"empty captchaToken","messagePattern":"empty captchaToken","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/thunderx/util.go","lineNumber":179,"sourceCode":"\tvar resp CaptchaTokenResponse\n\t_, err := c.Request(XLUSER_API_URL+\"/shield/captcha/init\", http.MethodPost, func(req *resty.Request) {\n\t\treq.SetError(&e).SetBody(param)\n\t}, &resp)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif e.IsError() {\n\t\treturn &e\n\t}\n\n\tif resp.Url != \"\" {\n\t\treturn fmt.Errorf(`need verify: <a target=\"_blank\" href=\"%s\">Click Here</a>`, resp.Url)\n\t}\n\n\tif resp.CaptchaToken == \"\" {\n\t\treturn fmt.Errorf(\"empty captchaToken\")\n\t}\n\n\tif c.refreshCTokenCk != nil {\n\t\tc.refreshCTokenCk(resp.CaptchaToken)\n\t}\n\tc.SetCaptchaToken(resp.CaptchaToken)\n\treturn nil\n}\n\n// Request 只有基础信息的请求\nfunc (c *Common) Request(url, method string, callback base.ReqCallback, resp interface{}) ([]byte, error) {\n\treq := c.client.R().SetHeaders(map[string]string{\n\t\t\"user-agent\":       c.UserAgent,\n\t\t\"accept\":           \"application/json;charset=UTF-8\",\n\t\t\"x-device-id\":      c.DeviceID,\n\t\t\"x-client-id\":      c.ClientID,\n\t\t\"x-client-version\": c.ClientVersion,\n\t})","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/thunderx/util.go#L161-L197","documentation":"ThunderX driver fails hard when the captcha-token endpoint returns 200 with an empty captchaToken and no verification Url. Without this token all subsequent signed browser API calls would be rejected, so the driver aborts with 'empty captchaToken'.","triggerScenarios":"The captcha token request in drivers/thunderx/util.go succeeds at the transport level, resp.Url is empty, and resp.CaptchaToken is empty — schema drift, soft rate-limit, or a dead/expired login session.","commonSituations":"Xunlei API updates changing the token field name, accounts flagged without a verification URL being offered, or hammering the endpoint after restart loops.","solutions":["Retry after waiting, then re-login to refresh the whole session (not just the token).","Confirm the account works on the official client and complete any pending verification there.","Upgrade the OpenList/driver version if the captcha-token response parsing changed upstream."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"empty captchaToken\") {\n    time.Sleep(5 * time.Second)\n    err = retryLoginAndToken() // full re-login refreshes session + token\n}","preventionTips":["Treat empty token as transient first, session-invalid second","Avoid request storms against the captcha endpoint","Keep the driver updated for response-schema fixes"],"tags":["thunderx","captcha","empty-response","authentication"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}