{"record":{"id":"e8ebcaa553e068cd","repo":"Billionmail/BillionMail","slug":"failed-to-get-all-mailboxes-w","errorCode":null,"errorMessage":"failed to get all mailboxes: %w","messagePattern":"failed to get all mailboxes: %w","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/controller/mail_boxes/mail_boxes_v1_get_all_mailbox.go","lineNumber":17,"sourceCode":"package mail_boxes\n\nimport (\n\t\"billionmail-core/api/mail_boxes/v1\"\n\t\"billionmail-core/internal/service/mail_boxes\"\n\t\"billionmail-core/internal/service/public\"\n\t\"context\"\n\t\"fmt\"\n)\n\nfunc (c *ControllerV1) GetAllMailbox(ctx context.Context, req *v1.GetAllMailboxReq) (res *v1.GetAllMailboxRes, err error) {\n\tres = &v1.GetAllMailboxRes{}\n\n\tres.Data, err = mail_boxes.All(ctx, req.Domain)\n\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to get all mailboxes: %w\", err)\n\t\treturn\n\t}\n\n\tres.SetSuccess(public.LangCtx(ctx, \"Success\"))\n\n\treturn\n}\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/controller/mail_boxes/mail_boxes_v1_get_all_mailbox.go#L1-L25","documentation":"GetAllMailbox wraps any error from mail_boxes.All(ctx, req.Domain) with this message. Like GetAllEmail, the failure is delegated to the service/DAO layer, so this error indicates the mailbox listing query failed (DB issue), not invalid input.","triggerScenarios":"Calling GetAllMailbox while the database is unavailable, schema is outdated, or the underlying mailbox query fails for the requested domain.","commonSituations":"DB connection limits reached; missing migration; replica lag or failover in progress.","solutions":["Inspect the wrapped error from mail_boxes.All for the root cause.","Check PostgreSQL health and connection pool usage.","Confirm the domain exists if the service layer errors on unknown domains, then retry."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if err := db.PingContext(ctx); err != nil {\n    return fmt.Errorf(\"database unreachable, skip GetAllMailbox: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"data, err := api.getAllMailbox(domain)\nif err != nil && strings.Contains(err.Error(), \"failed to get all mailboxes\") {\n    return retryWithBackoff(3, func() error { _, err = api.getAllMailbox(domain); return err })\n}","preventionTips":["Watch DB health metrics (connections, locks) that correlate with this error.","Keep schema migrations in sync with the deployed backend version.","Surface the wrapped inner error in your logs for faster diagnosis."],"tags":["database","mailboxes","query"],"backgroundTag":"database-query-failed","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}