Billionmail/BillionMail · error
failed to update task pause status: %w
Error message
failed to update task pause status: %w
What it means
UpdateTaskPauseStatus updates is_paused and task_process on an email_tasks row. A failed UPDATE is wrapped as "failed to update task pause status: %w". This is a write failure at the DB level; the function logs success afterward only if the update succeeded.
Source
Thrown at core/internal/service/batch_mail/batch_mail.go:556
func UpdateTaskPauseStatus(ctx context.Context, taskId int, isPaused bool) error {
pauseValue := 0
processValue := 1
if isPaused {
pauseValue = 1
processValue = 3
}
_, err := g.DB().Model("email_tasks").
Where("id", taskId).
Data(g.Map{
"pause": pauseValue,
"task_process": processValue,
}).
Update()
if err != nil {
return fmt.Errorf("failed to update task pause status: %w", err)
}
g.Log().Info(ctx, "Updated task %d pause status: isPaused=%v, task_process=%d", taskId, isPaused, processValue)
return nil
}
// UpdateTaskProcessStatus update task process status
func UpdateTaskProcessStatus(ctx context.Context, taskId int, status int) error {
_, err := g.DB().Model("email_tasks").
Where("id", taskId).
Data(g.Map{"task_process": status}).
Update()
if err != nil {
return fmt.Errorf("failed to update task process status: %w", err)
}
return nilView on GitHub (pinned to fc36c76c05)
Solutions
- Inspect the wrapped driver error to identify the DB cause
- Check for lock contention on the email_tasks row and long-running transactions
- Verify UPDATE permission on email_tasks and that writes go to the primary
- Retry the pause/resume operation once the DB is healthy
Defensive patterns
Strategy: retry
Validate before calling
if taskId <= 0 {
return errors.New("invalid taskId")
} Try / catch
if err := UpdateTaskPauseStatus(ctx, taskId, isPaused, process); err != nil {
if isTransientDBError(err) {
time.Sleep(time.Second)
return UpdateTaskPauseStatus(ctx, taskId, isPaused, process)
}
return err
} Prevention
- Route writes to the primary, never a read replica
- Monitor long transactions that lock email_tasks rows
- Verify UPDATE grants for the app DB user after migrations
- Make pause/resume idempotent so retries are safe
When it happens
Trigger: PauseTask or ResumeTask calls this while the UPDATE fails: DB connection lost, table locked by long transactions, permission denied on UPDATE, or a trigger/constraint on email_tasks rejecting the values.
Common situations: Toggling pause/resume from the UI during a Postgres restart; concurrent bulk updates holding row locks; read-only replica routed for writes; schema change without the new columns present.
Related errors
- failed to update task process status: %w
- failed to get all domains: %w
- fail to check domain: %w
- failed to load API templates: %v
- failed to load email templates: %v
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/f24b6b0900ff374c.
Report an issue: GitHub.