Billionmail/BillionMail · error

failed to send confirmation email: %w

Error message

failed to send confirmation email: %w

What it means

Chgrp looks up a group by name via user.LookupGroup and then recursively changes the target path's group to the found GID. It throws 'group not exists: <name>' when the GID parsed from the group entry is < 1 — i.e. the lookup yielded no valid GID (the record is empty/invalid). A truly unknown group would already fail earlier at LookupGroup, so this guards malformed group entries.

Source

Thrown at core/internal/controller/campaign/campaign_v1_form.go:169

            <p>Best regards,<br>The Team</p>
        </div>
        <div class="footer">
            <p>This email was sent to %s</p>
            <p>Powered by BillionMail</p>
        </div>
    </div>
</body>
</html>`, name, email)

	// Create email message
	message := mail_service.NewMessage(subject, content)
	message.SetMessageID(sender.GenerateMessageID())
	message.SetRealName("Newsletter Team")

	// Send the email
	err = sender.Send(message, []string{email})
	if err != nil {
		return fmt.Errorf("failed to send confirmation email: %w", err)
	}

	g.Log().Info(ctx, "Confirmation email sent successfully to %s", email)
	return nil
}

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Verify the group exists with a valid GID: getent group <name>
  2. Fix the corrupt /etc/group entry (or NSS/LDAP record) so Gid is a positive integer
  3. If the group is truly missing, create it: groupadd -g <gid> <name>
  4. Alternatively call ChgrpWithGidRecursive directly with a known-good numeric GID to bypass the name lookup

Example fix

// before
err := public.Chgrp("/var/www", "deployers") // corrupt group entry, gid=0
// after
if out, err := exec.Command("getent", "group", "deployers").Output(); err != nil || len(out) == 0 {
	return fmt.Errorf("group deployers missing/invalid")
}
err := public.ChgrpWithGidRecursive("/var/www", 1001)
Defensive patterns

Strategy: validation

Validate before calling

if grp, err := user.LookupGroup(groupName); err != nil || gconv.Int(grp.Gid) < 1 {
	return fmt.Errorf("group %s has no valid GID; fix /etc/group or groupadd it", groupName)
}

Try / catch

if err := public.Chgrp(path, groupName); err != nil {
	if strings.Contains(err.Error(), "group not exists") {
		// create the group or use ChgrpWithGidRecursive with a numeric GID
	}
	return err
}

Prevention

When it happens

Trigger: Calling Chgrp(path, groupName) where the group record returned by the system has an empty or zero Gid string — corrupt /etc/group entry, NSS plugin returning an empty Gid, or a group named '0'/'-1' edge case.

Common situations: Broken /etc/group after manual editing; LDAP/SSSD directory issues returning incomplete group records; running in minimal containers with an incomplete group database.

Related errors


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