openimsdk/open-im-server · error
jpush push failed %v
Error message
jpush push failed %v
What it means
After sending a push to JPush, request() checks the response's 'sendno' field; JPush signals acceptance with sendno==0. Any other value (or a non-zero sendno in the response map) is treated as a failed push and wrapped as 'jpush push failed %v' with the whole response map for debugging. It means JPush rejected or did not accept the push request.
Source
Thrown at internal/push/offlinepush/jpush/push.go:104
return j.request(ctx, pushObj, &resp, 5)
}
func (j *JPush) request(ctx context.Context, po body.PushObj, resp *map[string]any, timeout int) error {
err := j.httpClient.PostReturn(
ctx,
j.pushConf.JPush.PushURL,
map[string]string{
"Authorization": j.getAuthorization(j.pushConf.JPush.AppKey, j.pushConf.JPush.MasterSecret),
},
po,
resp,
timeout,
)
if err != nil {
return err
}
if (*resp)["sendno"] != "0" {
return fmt.Errorf("jpush push failed %v", resp)
}
return nil
}
View on GitHub (pinned to 175a7bb067)
Solutions
- Log/inspect the full resp map in the error to see JPush's error field and code
- Verify appkey and master secret in the JPush push config
- Refresh the device registration_id before pushing
- Add retry with backoff for transient JPush rejections
Example fix
// before resp sendno: "1003" -> 'jpush push failed map[error:...msg invalid regid]' // after regID := refreshJPushRegID(ctx, userID); client.Push(ctx, regID, msg)
Defensive patterns
Strategy: try-catch
Validate before calling
if jpushCfg.AppKey == "" || jpushCfg.MasterSecret == "" {
return errors.New("jpush credentials not configured")
}
if regID == "" { return errors.New("missing jpush registration_id") } Try / catch
if err := client.Push(ctx, regID, msg); err != nil {
if strings.Contains(err.Error(), "jpush push failed") {
log.ZWarn(ctx, "jpush rejected push, inspect resp in error", err)
// backoff and retry once for transient errors
}
return err
} Prevention
- Verify appkey/mastersecret after any JPush dashboard change
- Refresh registration_ids when devices re-register
- Keep payloads under JPush size limits
- Add retry with backoff for transient failures
When it happens
Trigger: JPush HTTP request completes but the JSON response's sendno is not "0" — invalid app key/master secret, bad registration_id, payload exceeding limits, or JPush-side rejection.
Common situations: Expired or wrong JPush appkey/mastersecret in push config; pushing to a device whose registration_id is stale; message body too large; JPush service degradation.
Related errors
AI-assisted analysis of openimsdk/open-im-server@175a7bb067 (2026-09-04).
Data as JSON: /api/errors/2dbfdc13f4846bfb.
Report an issue: GitHub.