Billionmail/BillionMail · error

Decode password failed: %w

Error message

Decode password failed: %w

What it means

Thrown by AddImport when a mailbox record carries an encrypted PasswordEncode but no plaintext Password, and PasswdDecode fails to decrypt the stored encoded password. The decoded plaintext is then needed for md5-crypt hashing, so the import aborts.

Source

Thrown at core/internal/service/mail_boxes/mail_boxes.go:385

		return nil, fmt.Errorf("Failed to create email: %w", err)
	}

	if len(emailList) == 0 {
		return nil, fmt.Errorf("Failed to create any mailbox")
	}

	return emailList, nil
}

// AddImport
func AddImport(ctx context.Context, mailbox *v1.Mailbox) (err error) {

	if mailbox.PasswordEncode != "" {

		if mailbox.Password == "" {
			mailbox.Password, err = PasswdDecode(ctx, mailbox.PasswordEncode)
			if err != nil {
				err = fmt.Errorf("Decode password failed: %w", err)
				return
			}

			mailbox.Password, err = PasswdMD5Crypt(ctx, mailbox.Password)
			if err != nil {
				err = fmt.Errorf("Generate password md5-crypt failed: %w", err)
				return
			}
		}

	} else {

		mailbox.PasswordEncode = PasswdEncode(ctx, mailbox.Password)
		mailbox.Password, err = PasswdMD5Crypt(ctx, mailbox.Password)
		if err != nil {
			err = fmt.Errorf("Generate password md5-crypt failed: %w", err)
			return
		}

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Ensure the encryption key/secret used by PasswdEncode/PasswdDecode matches the one that encrypted the source PasswordEncode value
  2. Re-export the source data from the original environment with matching keys, or reset the password and import plaintext Password instead
  3. Verify the PasswordEncode value is not truncated or corrupted in the import source
Defensive patterns

Strategy: validation

Validate before calling

if mailbox.PasswordEncode != "" && mailbox.Password == "" {
    // verify decode key matches source environment before importing
    if _, err := PasswdDecode(ctx, mailbox.PasswordEncode); err != nil {
        // reset password or re-export with matching key
    }
}

Prevention

When it happens

Trigger: Calling ImportMailbox (via AddImport) with PasswordEncode set, Password empty, and PasswdDecode failing — typically because PasswordEncode was encrypted with a different key than the one configured at import time.

Common situations: Migrating mailbox data between deployments with different encryption keys/secrets; corrupted or hand-edited PasswordEncode values; importing records exported from another BillionMail instance.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/31f8765e6668fd13. Report an issue: GitHub.