caddyserver/caddy · error

generating and storing new replacement ECH config: %w

Error message

generating and storing new replacement ECH config: %w

What it means

Error "generating and storing new replacement ECH config: %w" thrown in caddyserver/caddy.

Source

Thrown at modules/caddytls/ech.go:238

	}

	// iterate the updated list and do any updates as needed
	for publicName := range ech.configs {
		for i := 0; i < len(ech.configs[publicName]); i++ {
			cfg := ech.configs[publicName][i]
			if time.Since(cfg.meta.Created) >= rotationInterval && cfg.meta.Replaced.IsZero() {
				// key is due for rotation and it hasn't been replaced yet; do that now
				logger.Debug("ECH config is due for rotation",
					zap.String("public_name", cfg.RawPublicName),
					zap.Uint8("id", cfg.ConfigID),
					zap.Time("created", cfg.meta.Created),
					zap.Duration("age", time.Since(cfg.meta.Created)),
					zap.Duration("rotation_interval", rotationInterval))

				// start by generating and storing the replacement ECH config
				newCfg, err := generateAndStoreECHConfig(ctx, publicName)
				if err != nil {
					return fmt.Errorf("generating and storing new replacement ECH config: %w", err)
				}

				// mark the key as replaced so we don't rotate it again, and instead delete it later
				ech.configs[publicName][i].meta.Replaced = time.Now()

				// persist the updated metadata
				metaBytes, err := json.Marshal(ech.configs[publicName][i].meta)
				if err != nil {
					return fmt.Errorf("marshaling updated ECH config metadata: %v", err)
				}
				if err := storage.Store(ctx, echMetaKey(cfg.ConfigID), metaBytes); err != nil {
					return fmt.Errorf("storing updated ECH config metadata: %v", err)
				}

				ech.configs[publicName] = append(ech.configs[publicName], newCfg)

				logger.Debug("rotated ECH key",
					zap.String("public_name", cfg.RawPublicName),

View on GitHub (pinned to 50e54ee279)

Solutions

  1. Check the wrapped error; generating or storing the replacement ECH config failed, often a storage or RNG problem.

When it happens

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