Billionmail/BillionMail · error

dovecot conf dir not found: %s

Error message

dovecot conf dir not found: %s

What it means

The function resolves the Dovecot configuration root as ../conf/dovecot relative to the host work dir and verifies it exists with os.Stat. This error reports the directory is absent, so the quota plugin files cannot be patched.

Source

Thrown at core/internal/service/mail_boxes/init_quota_plugin.go:39

// Modify dovecot.conf, 20-pop3.conf, and 90-quota.conf.
// Rebuild dovecot-sql.conf.ext
// Check all mailboxes and add the maildirsize file (make sure the file permissions are correct)

func InitQuotaPluginAndUpdateUsedSpace(ctx context.Context) error {
	if public.HostWorkDir == "" {
		return errors.New("HostWorkDir not set")
	}

	markPath := public.AbsPath("../core/data/quota_init_done.mark")

	if gfile.Exists(markPath) {
		return nil
	}

	confRoot := public.AbsPath("../conf/dovecot")

	if _, err := os.Stat(confRoot); os.IsNotExist(err) {
		return fmt.Errorf("dovecot conf dir not found: %s", confRoot)
	}

	// 1. Modify dovecot.conf
	if err := ensureDovecotConf(confRoot); err != nil {
		return err
	}

	// 2. Modify 20-pop3.conf
	if err := ensurePop3Conf(confRoot); err != nil {
		g.Log().Debug(ctx, " Modify 20-pop3.conf err:", err)
		return err
	}

	// 3. /conf.d/90-quota.conf
	if err := ensureQuotaConf(confRoot); err != nil {
		g.Log().Debug(ctx, " Modify /conf.d/90-quota.conf err:", err)
		return err
	}

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Verify the conf/dovecot directory exists relative to HostWorkDir (ls $HostWorkDir/../conf/dovecot)
  2. Correct public.HostWorkDir to point at the actual deployment root
  3. Re-deploy or restore the conf/dovecot directory from the repository/installer
  4. Check the error's %s value to see the exact path that was probed

Example fix

// before
confRoot := public.AbsPath("../conf/dovecot")
// after
confRoot := public.AbsPath("../conf/dovecot")
if fi, err := os.Stat(confRoot); err != nil || !fi.IsDir() {
	return fmt.Errorf("dovecot conf dir not found: %s (HostWorkDir=%s)", confRoot, public.HostWorkDir)
}
Defensive patterns

Strategy: validation

Validate before calling

confRoot := filepath.Join(public.HostWorkDir, "..", "conf", "dovecot")
if fi, err := os.Stat(confRoot); err != nil || !fi.IsDir() {
	return fmt.Errorf("conf/dovecot missing under work dir %s", public.HostWorkDir)
}

Try / catch

if err := mail_boxes.InitQuotaPluginAndUpdateUsedSpace(ctx); err != nil && strings.HasPrefix(err.Error(), "dovecot conf dir not found") {
	log.Printf("deployment incomplete — restore conf/dovecot: %s", err)
}

Prevention

When it happens

Trigger: os.Stat(confRoot) returns IsNotExist: the conf/dovecot directory is missing under HostWorkDir, or HostWorkDir points at the wrong directory so the relative ../conf/dovecot path resolves nowhere.

Common situations: Partial deployment missing the conf/ directory; running from a packaged binary where ../conf/dovecot is not shipped; HostWorkDir misconfigured to an app dir instead of the deployment root; wrong install layout after upgrade.

Related errors


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