Billionmail/BillionMail · error
Prefix validation error: %w
Error message
Prefix validation error: %w
What it means
Thrown by BatchAdd when regexp.MatchString fails while validating the mailbox prefix against ^[\w-]+$. MatchString only errors on an invalid regular expression, which here is a compile-time constant, so in practice this error is nearly unreachable and always indicates an internal/regexp-engine problem rather than bad user input.
Source
Thrown at core/internal/service/mail_boxes/mail_boxes.go:255
for i := range password {
password[i] = charset[rand.Intn(len(charset))]
}
return string(password)
}
func BatchAdd(ctx context.Context, domain string, quota int, count int, prefix string, quotaActive int) ([]string, error) {
if prefix == "" {
randomPre := make([]byte, 4)
for j := 0; j < 4; j++ {
randomPre[j] = byte(rand.Intn(26) + 97) // a-z的ASCII码
}
prefix = string(randomPre)
}
matched, err := regexp.MatchString(`^[\w-]+$`, prefix)
if err != nil {
return nil, fmt.Errorf("Prefix validation error: %w", err)
}
if !matched {
return nil, fmt.Errorf("Prefixes can contain only letters, numbers, underscores, and hyphens")
}
rand.Seed(time.Now().UnixNano())
createdEmails := make([]string, 0, count)
timestamp := time.Now().Unix()
//passwordEncoded := PasswdEncode(ctx, password)
//passwordCrypted, err := PasswdMD5Crypt(ctx, password)
//if err != nil {
// return nil, fmt.Errorf("Generate password md5-crypt failed: %w", err)
//}
mailboxes := make([]v1.Mailbox, 0, count)View on GitHub (pinned to fc36c76c05)
Solutions
- Confirm the regex literal ^[\w-]+$ in mail_boxes.go was not modified to an invalid pattern
- Check the wrapped error from %w for the exact regexp compile message
- Rebuild/redeploy the binary with an unmodified, supported Go toolchain
Defensive patterns
Strategy: try-catch
Try / catch
if err != nil && strings.Contains(err.Error(), "Prefix validation error") {
// internal regexp failure: report as a bug, do not retry blindly
} Prevention
- Run production builds with a standard supported Go toolchain
- Do not modify the hard-coded validation regex
- Treat occurrences of this error as an internal defect report
When it happens
Trigger: Calling BatchAddMailbox (via BatchAdd) and the Go regexp engine fails to compile/match the hard-coded pattern ^[\w-]+$ during prefix validation.
Common situations: Extremely rare; could occur with a corrupted Go installation, a modified copy of the code where the pattern string is built dynamically and contains invalid regex syntax, or exotic regexp-engine edge cases.
Related errors
- Add up to 3 URLs
- supplier name, base URL, and API key are required
- invalid base URL format: %w
- base URL must use http or https protocol
- Prefixes can contain only letters, numbers, underscores, and
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/14cd082610740ed1.
Report an issue: GitHub.