Billionmail/BillionMail · warning

alert settings file not found

Error message

alert settings file not found

What it means

loadBlacklistAlertSettingsForAlert reads blacklist alert configuration from ../core/data/blacklist_alert_settings.json (resolved via public.AbsPath) and returns this error when gfile.Exists reports the file is missing. It is a guard so sendBlacklistAlert can skip alerting (rather than crash) when the admin has never configured blacklist alerts.

Source

Thrown at core/internal/service/domains/blacklist.go:457

	}

	g.Log().Infof(ctx, "✅ Blacklist alert sent successfully for domain: %s to %d recipients", domain, len(alertSettings.RecipientList))
}

type BlacklistAlertSettings struct {
	Name          string   `json:"name"`
	SenderEmail   string   `json:"sender_email"`
	SMTPPassword  string   `json:"smtp_password"`
	SMTPServer    string   `json:"smtp_server"`
	SMTPPort      int      `json:"smtp_port"`
	RecipientList []string `json:"recipient_list"`
}

func loadBlacklistAlertSettingsForAlert() (*BlacklistAlertSettings, error) {
	alertSettingsFile := public.AbsPath("../core/data/blacklist_alert_settings.json")

	if !gfile.Exists(alertSettingsFile) {
		return nil, fmt.Errorf("alert settings file not found")
	}

	content := gfile.GetContents(alertSettingsFile)
	if content == "" {
		return nil, fmt.Errorf("alert settings file is empty")
	}

	var settings BlacklistAlertSettings
	err := json.Unmarshal([]byte(content), &settings)
	if err != nil {
		return nil, fmt.Errorf("failed to parse alert settings: %v", err)
	}

	return &settings, nil
}

func sendAlertEmail(ctx context.Context, settings *BlacklistAlertSettings, subject, body string) error {

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Create/configure blacklist alert settings in the UI so the JSON file is written to core/data/blacklist_alert_settings.json
  2. Verify the data volume is mounted and persists at the expected AbsPath location
  3. Confirm the process working directory makes public.AbsPath("../core/data/...") resolve to the real data dir
  4. Treat this as an expected condition: skip alerting and log an informational message rather than an error

Example fix

// before
if !gfile.Exists(alertSettingsFile) {
	return nil, fmt.Errorf("alert settings file not found")
}
// after
if !gfile.Exists(alertSettingsFile) {
	g.Log().Infof(ctx, "blacklist alert settings not configured at %s; skipping alert", alertSettingsFile)
	return nil, nil
}
Defensive patterns

Strategy: validation

Validate before calling

settingsPath := public.AbsPath("../core/data/blacklist_alert_settings.json")
if !gfile.Exists(settingsPath) {
	// alerts not configured: skip silently or prompt admin to configure
	return nil
}

Type guard

func alertSettingsConfigured() bool {
	return gfile.Exists(public.AbsPath("../core/data/blacklist_alert_settings.json"))
}

Try / catch

settings, err := loadBlacklistAlertSettingsForAlert()
if err != nil {
	if err.Error() == "alert settings file not found" {
		g.Log().Info(ctx, "blacklist alerts not configured; skipping")
		return nil
	}
	return err
}

Prevention

When it happens

Trigger: sendBlacklistAlert fires (an IP/domain was found blacklisted) but ../core/data/blacklist_alert_settings.json does not exist — i.e. no one saved alert settings yet, or the file was deleted/moved.

Common situations: Fresh BillionMail install where alert settings were never configured; data directory recreated or volume not mounted so the JSON is lost; container deployment where ../core/data path resolution differs from the host volume; file deleted by cleanup scripts.

Related errors


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