{"record":{"id":"f156fd6480a5d6a5","repo":"AlistGo/alist","slug":"failed-to-refresh-token-s-f156fd","errorCode":null,"errorMessage":"failed to refresh token: %s","messagePattern":"failed to refresh token: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/aliyundrive_share/util.go","lineNumber":31,"sourceCode":"\t// CanaryHeaderKey CanaryHeaderValue for lifting rate limit restrictions\n\tCanaryHeaderKey   = \"X-Canary\"\n\tCanaryHeaderValue = \"client=web,app=share,version=v2.3.1\"\n)\n\nfunc (d *AliyundriveShare) refreshToken() error {\n\turl := \"https://auth.alipan.com/v2/account/token\"\n\tvar resp base.TokenResp\n\tvar e ErrorResp\n\t_, err := base.RestyClient.R().\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\td.RefreshToken, d.AccessToken = resp.RefreshToken, resp.AccessToken\n\top.MustSaveDriverStorage(d)\n\treturn nil\n}\n\n// do others that not defined in Driver interface\nfunc (d *AliyundriveShare) getShareToken() error {\n\tdata := base.Json{\n\t\t\"share_id\": d.ShareId,\n\t}\n\tif d.SharePwd != \"\" {\n\t\tdata[\"share_pwd\"] = d.SharePwd\n\t}\n\tvar e ErrorResp\n\tvar resp ShareTokenResp\n\t_, err := base.RestyClient.R().\n\t\tSetResult(&resp).SetError(&e).SetBody(data).","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/aliyundrive_share/util.go#L13-L49","documentation":"Error \"failed to refresh token: %s\" thrown in AlistGo/alist.","triggerScenarios":"Thrown at drivers/aliyundrive_share/util.go:31 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"}