{"record":{"id":"2d897f0380445a9b","repo":"AlistGo/alist","slug":"failed-to-refresh-token-s-2d897f","errorCode":null,"errorMessage":"failed to refresh token: %s","messagePattern":"failed to refresh token: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/aliyundrive/util.go","lineNumber":74,"sourceCode":"}\n\n// do others that not defined in Driver interface\n\nfunc (d *AliDrive) refreshToken() error {\n\turl := \"https://auth.alipan.com/v2/account/token\"\n\tvar resp base.TokenResp\n\tvar e RespErr\n\t_, err := base.RestyClient.R().\n\t\t//ForceContentType(\"application/json\").\n\t\tSetBody(base.Json{\"refresh_token\": d.RefreshToken, \"grant_type\": \"refresh_token\"}).\n\t\tSetResult(&resp).\n\t\tSetError(&e).\n\t\tPost(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif e.Code != \"\" {\n\t\treturn fmt.Errorf(\"failed to refresh token: %s\", e.Message)\n\t}\n\tif resp.RefreshToken == \"\" {\n\t\treturn errors.New(\"failed to refresh token: refresh token is empty\")\n\t}\n\td.RefreshToken, d.AccessToken = resp.RefreshToken, resp.AccessToken\n\top.MustSaveDriverStorage(d)\n\treturn nil\n}\n\nfunc (d *AliDrive) request(url, method string, callback base.ReqCallback, resp interface{}) ([]byte, error, RespErr) {\n\treq := base.RestyClient.R()\n\tstate, ok := global.Load(d.UserID)\n\tif !ok {\n\t\tif url == \"https://api.alipan.com/v2/user/get\" {\n\t\t\tstate = &State{}\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"can't load user state, user_id: %s\", d.UserID), RespErr{}\n\t\t}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/aliyundrive/util.go#L56-L92","documentation":"Error \"failed to refresh token: %s\" thrown in AlistGo/alist.","triggerScenarios":"Thrown at drivers/aliyundrive/util.go:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-authenticate the storage: obtain a new refresh_token via the provider's OAuth flow and update the storage configuration.","Verify client_id/client_secret are correct and the refresh token has not been revoked or expired."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}