Billionmail/BillionMail · error
Failed to remove exception recipient: %w
Error message
Failed to remove exception recipient: %w
What it means
Delete removes one row from abnormal_recipient by id via g.DB().Model(...).Delete(). Any SQL failure (bad connection, table missing, permission denied) is wrapped as this error and returned to DeleteAbnormalRecipient.
Source
Thrown at core/internal/service/abnormal_recipient/abnormal_recipient.go:75
"create_time": now,
}).
InsertIgnore()
if err != nil {
return fmt.Errorf("Failed to add exception recipient: %w", err)
}
return nil
}
func Delete(ctx context.Context, id int) error {
_, err := g.DB().Model("abnormal_recipient").
Where("id", id).
Delete()
if err != nil {
return fmt.Errorf("Failed to remove exception recipient: %w", err)
}
return nil
}
func GetAbnormalRecipient(ctx context.Context, id int) (*entity.AbnormalRecipient, error) {
var recipient entity.AbnormalRecipient
err := g.DB().Model("abnormal_recipient").Where("id", id).Scan(&recipient)
if err != nil {
return nil, fmt.Errorf("Failed to get exception recipient: %w", err)
}
return &recipient, nil
}
func BatchUpsertAbnormalRecipients(ctx context.Context, recipients []string, addType int, description string) error {
now := time.Now().Unix()
if len(recipients) == 0 {View on GitHub (pinned to fc36c76c05)
Solutions
- Confirm DB connectivity and that the abnormal_recipient table exists.
- Check DELETE grants for the app's DB role.
- Inspect the wrapped driver error for the precise SQL failure.
- Note: a nonexistent id is not an error here — only SQL failures are.
Example fix
// before
abnormal_recipient.Delete(ctx, id)
// after
if err := abnormal_recipient.Delete(ctx, id); err != nil {
logger.Error(ctx, "delete abnormal recipient", "id", id, "err", err)
return err
} Defensive patterns
Strategy: try-catch
Validate before calling
// before calling Delete
if id <= 0 { return errors.New("invalid id") } Try / catch
if err := abnormal_recipient.Delete(ctx, id); err != nil {
logger.Error(ctx, "delete failed", "id", id, "err", err)
return fmt.Errorf("delete recipient %d: %w", id, err)
} Prevention
- Validate id > 0 before calling
- Check DB DELETE grants for the app role
- Watch for connection-pool exhaustion in metrics
When it happens
Trigger: Calling Delete(ctx, id) with the database down, abnormal_recipient absent, or the DB role lacking DELETE privilege.
Common situations: Deleting a stale recipient after the DB was migrated/recreated; connection pool exhaustion after idle timeout; read-only replicas receiving writes.
Related errors
- Failed to add exception recipient: %w
- Failed to get exception recipient: %w
- Failed to query existing abnormal recipients: %w
- Failed to update abnormal recipient: %w
- Failed to insert abnormal recipients: %w
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/682aff9592f64671.
Report an issue: GitHub.