Billionmail/BillionMail · error
failed to get all emails: %w
Error message
failed to get all emails: %w
What it means
GetAllEmail wraps any error returned by mail_boxes.AllEmail(ctx, req.Domain) with this message. AllEmail reads every email address for a domain, so the wrapped error is typically a database/query failure, not a client-input problem.
Source
Thrown at core/internal/controller/mail_boxes/mail_boxes_v1_get_all_email.go:18
package mail_boxes
import (
"billionmail-core/internal/service/mail_boxes"
"billionmail-core/internal/service/public"
"context"
"fmt"
"billionmail-core/api/mail_boxes/v1"
)
func (c *ControllerV1) GetAllEmail(ctx context.Context, req *v1.GetAllEmailReq) (res *v1.GetAllEmailRes, err error) {
res = &v1.GetAllEmailRes{}
res.Data, err = mail_boxes.AllEmail(ctx, req.Domain)
if err != nil {
err = fmt.Errorf("failed to get all emails: %w", err)
return
}
res.SetSuccess(public.LangCtx(ctx, "Success"))
return
}
View on GitHub (pinned to fc36c76c05)
Solutions
- Read the wrapped inner error to identify the actual DB failure.
- Verify PostgreSQL connectivity and that migrations have run (mail_boxes tables exist).
- Retry the request if the failure was transient (pool exhaustion, timeout).
Defensive patterns
Strategy: retry
Validate before calling
// Light pre-check: DB reachable before listing
if err := db.PingContext(ctx); err != nil {
return fmt.Errorf("database unreachable, skip GetAllEmail: %w", err)
} Try / catch
data, err := api.getAllEmail(domain)
if err != nil && strings.Contains(err.Error(), "failed to get all emails") {
// log the wrapped cause; retry with backoff for transient DB failures
return retryWithBackoff(3, func() error { _, err = api.getAllEmail(domain); return err })
} Prevention
- Monitor PostgreSQL connectivity and pool saturation.
- Run migrations before deploying API versions that query new tables.
- Add client-side retry with backoff for listing endpoints.
When it happens
Trigger: Calling GetAllEmail when the database is unreachable, the mail_boxes table/schema is missing, or mail_boxes.AllEmail encounters a query error for the given domain.
Common situations: PostgreSQL down or connection pool exhausted; migration not applied; transient DB timeout during heavy load.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- failed to get all mailboxes: %w
- Failed to get the total number of exception recipients: %w
- Failed to get the exception recipient list: %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/af270e1fc70d8c49.
Report an issue: GitHub.