caddyserver/caddy · error

rotating ECH configs

Error message

rotating ECH configs: %w

What it means

ECH.Provision wraps rotateECHKeys failing during the final rotation pass: old/expired ECH keys could not be rotated out after configs were loaded or generated, so the provisioned key list may contain keys due for retirement and provisioning fails.

Solutions

  1. Check the wrapped error and storage backend; ECH config rotation failed.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at modules/caddytls/ech.go:140 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/5310c41539a8c740. Report an issue: GitHub.

Appendix: source

Thrown at modules/caddytls/ech.go:140

			// no config with this public name was loaded, so create one
			echCfg, err := generateAndStoreECHConfig(ctx, publicName)
			if err != nil {
				return nil, err
			}
			logger.Debug("generated new ECH config",
				zap.String("public_name", echCfg.RawPublicName),
				zap.Uint8("id", echCfg.ConfigID))
			ech.configs[publicName] = append(ech.configs[publicName], echCfg)
			outerNames = append(outerNames, publicName)
		}
	}

	// convert the configs into a structure ready for the std lib to use
	ech.updateKeyList()

	// ensure any old keys are rotated out
	if err = ech.rotateECHKeys(ctx, logger, true); err != nil {
		return nil, fmt.Errorf("rotating ECH configs: %w", err)
	}

	return outerNames, nil
}

// setConfigsFromStorage sets the ECH configs in memory to those in storage.
// It must be called in a write lock on ech.configsMu.
func (ech *ECH) setConfigsFromStorage(ctx caddy.Context, logger *zap.Logger) ([]string, error) {
	storage := ctx.Storage()

	ech.configs = make(map[string][]echConfig)

	var outerNames []string

	// start by loading all the existing configs (even the older ones on the way out,
	// since some clients may still be using them if they haven't yet picked up on the
	// new configs)
	cfgKeys, err := storage.List(ctx, echConfigsKey, false)

View on GitHub (pinned to 50e54ee279)