{"record":{"id":"7a54fb80aeecf738","repo":"AlistGo/alist","slug":"empty-captchatoken-7a54fb","errorCode":null,"errorMessage":"empty captchaToken","messagePattern":"empty captchaToken","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/thunder_browser/util.go","lineNumber":175,"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":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/thunder_browser/util.go#L157-L193","documentation":"Thrown by the thunder_browser driver when the captcha-token endpoint returns HTTP 200 with neither a Url nor a captchaToken field. The driver treats an empty captchaToken as a hard failure because every subsequent browser-API request must carry this token.","triggerScenarios":"The captcha token request completes without transport error and without resp.Url, but resp.CaptchaToken == \"\" — e.g. API changed response schema, rate-limited/soft-blocked account returning an empty 200, or login session invalidated server-side.","commonSituations":"Upstream Thunder API contract changes after an app update, account in a flagged state that neither issues a token nor a verification URL, or interim server responses during maintenance.","solutions":["Retry the login after a short wait — transient empty responses happen during rate limiting.","Verify account status by logging into the official Thunder web client; clear verification there if prompted.","Update OpenList/the driver to the latest version in case the captcha-token endpoint or payload changed.","Check the raw response logging (enable debug) to confirm whether the endpoint moved or the JSON shape changed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var err error\nfor attempt := 0; attempt < 3; attempt++ {\n    err = c.getCaptchaToken(...)\n    if err == nil || !strings.Contains(err.Error(), \"empty captchaToken\") { break }\n    time.Sleep(time.Duration(attempt+1) * 2 * time.Second)\n}","preventionTips":["Cache and refresh captcha tokens instead of requesting per call","Re-login fully when empty-token responses persist","Watch driver updates for API schema changes"],"tags":["thunder","captcha","authentication","empty-response"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}