{"record":{"id":"f5eef5abc51f7b75","repo":"openimsdk/open-im-server","slug":"code-d-msg-s","errorCode":null,"errorMessage":"code %d, msg %s","messagePattern":"code (.+?), msg (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/push/offlinepush/getui/body.go","lineNumber":46,"sourceCode":"\t\tDefault: 1,\n\t}\n\tmsgCategory = \"CATEGORY_MESSAGE\"\n)\n\ntype Resp struct {\n\tCode int    `json:\"code\"`\n\tMsg  string `json:\"msg\"`\n\tData any    `json:\"data\"`\n}\n\nfunc (r *Resp) parseError() (err error) {\n\tswitch r.Code {\n\tcase tokenExpireCode:\n\t\terr = ErrTokenExpire\n\tcase 0:\n\t\terr = nil\n\tdefault:\n\t\terr = fmt.Errorf(\"code %d, msg %s\", r.Code, r.Msg)\n\t}\n\treturn err\n}\n\ntype RespI interface {\n\tparseError() error\n}\n\ntype AuthReq struct {\n\tSign      string `json:\"sign\"`\n\tTimestamp string `json:\"timestamp\"`\n\tAppKey    string `json:\"appkey\"`\n}\n\ntype AuthResp struct {\n\tExpireTime string `json:\"expire_time\"`\n\tToken      string `json:\"token\"`\n}","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/openimsdk/open-im-server/blob/175a7bb0673eca18e9d1b10bff4f728da6b1b513/internal/push/offlinepush/getui/body.go#L28-L64","documentation":"getui (GeTui push service) responses are parsed by parseError, which maps tokenExpireCode to ErrTokenExpire and code 0 to success. Any other code means GeTui rejected the request, and the raw code/msg pair is surfaced as fmt.Errorf(\"code %d, msg %s\", ...). It indicates an upstream push API failure (auth, quota, bad cid, etc.).","triggerScenarios":"A push request to GeTui returns a Resp whose Code is neither 0 nor the token-expire code — e.g. invalid appkey/secret, expired credentials other than the known expire code, invalid target cid, or rate limiting.","commonSituations":"Wrong or rotated GeTui app credentials in config; push token (cid) of an uninstalled/invalid device; exceeding GeTui QPS/quota; GeTui API changes introducing new error codes.","solutions":["Read r.Code and r.Msg in the error; look up the code in GeTui's API docs for the specific cause","Fix GeTui credentials (appkey/appid/mastersecret) in the push config","Refresh the device token / stop pushing to stale cids","Implement backoff if the code indicates rate limiting"],"exampleFix":"// before\npusher.Push(ctx, badCID, msg) // -> 'code 20002, msg cid invalid'\n// after\ntoken := getValidDeviceToken(userID); pusher.Push(ctx, token, msg)","handlingStrategy":"try-catch","validationCode":"// validate credentials and cid before pushing\nif pushCfg.Getui.AppKey == \"\" || pushCfg.Getui.MasterSecret == \"\" {\n\treturn errors.New(\"getui credentials not configured\")\n}\nif deviceToken == \"\" { return errors.New(\"no valid getui cid for user\") }","typeGuard":null,"tryCatchPattern":"if err := resp.parseError(); err != nil {\n\tif errors.Is(err, ErrTokenExpire) {\n\t\tif rerr := reissueTokenAndRetry(ctx, req); rerr != nil { return rerr }\n\t} else {\n\t\tlog.ZWarn(ctx, \"getui push rejected\", err) // inspect code/msg for cause\n\t}\n}","preventionTips":["Keep GeTui appkey/appid/mastersecret current in config","Purge stale device cids from the push table","Handle token-expire code with automatic re-auth + retry","Watch GeTui docs for new response codes"],"tags":["push-notifications","getui","third-party-api"],"backgroundTag":"push-provider-error","analyzedSha":"175a7bb0673eca18e9d1b10bff4f728da6b1b513","analyzedAt":"2026-09-04T16:52:56.821Z","contentChangedAt":"2026-09-04T16:52:56.821Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}