caddyserver/caddy · error

loading ECH publication modules

Error message

loading ECH publication modules: %v

What it means

ECH.Provision wraps ctx.LoadModule failing to instantiate the configured ECH publication (DNS) modules: one of the raw publication provider configs could not be loaded, so ECH configs cannot later be published and provisioning aborts.

Solutions

  1. Check the ECH publication module names and configuration; the wrapped error identifies the failing module.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at modules/caddytls/ech.go:90 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/fb2de582c671ec25. Report an issue: GitHub.

Appendix: source

Thrown at modules/caddytls/ech.go:90

	configsMu   *sync.RWMutex                 // protects both configs and the list of configs/keys the standard library uses
	configs     map[string][]echConfig        // map of public_name to list of configs
	stdlibReady []tls.EncryptedClientHelloKey // ECH configs+keys in a format the standard library can use
}

// Provision loads or creates ECH configs and returns outer names (for certificate
// management), but does not publish any ECH configs. The DNS module is used as
// a default for later publishing if needed.
func (ech *ECH) Provision(ctx caddy.Context) ([]string, error) {
	ech.configsMu = new(sync.RWMutex)

	logger := ctx.Logger().Named("ech")

	// set up publication modules before we need to obtain a lock in storage,
	// since this is strictly internal and doesn't require synchronization
	for i, pub := range ech.Publication {
		mods, err := ctx.LoadModule(pub, "PublishersRaw")
		if err != nil {
			return nil, fmt.Errorf("loading ECH publication modules: %v", err)
		}
		for _, modIface := range mods.(map[string]any) {
			ech.Publication[i].publishers = append(ech.Publication[i].publishers, modIface.(ECHPublisher))
		}
	}

	// the rest of provisioning needs an exclusive lock so that instances aren't
	// stepping on each other when setting up ECH configs
	storage := ctx.Storage()
	if err := storage.Lock(ctx, echStorageLockName); err != nil {
		return nil, err
	}
	defer func() {
		if err := storage.Unlock(ctx, echStorageLockName); err != nil {
			logger.Error("unable to unlock ECH provisioning in storage", zap.Error(err))
		}
	}()

View on GitHub (pinned to 50e54ee279)