XTLS/Xray-core · error

Failed to build ech sockopt.

Error message

Failed to build ech sockopt.

What it means

TLS config Build fails while building the socket options for ECH from ECHSocketSettings; the chained error comes from the socket settings builder (e.g. invalid sockopt values), not from ECH key parsing itself.

Solutions

  1. Fix the invalid sockopt entries under echSocketSettings
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at infra/conf/transport_security.go:402 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/5148daaa9e216a3a. Report an issue: GitHub.

Appendix: source

Thrown at infra/conf/transport_security.go:402

			if v == "" {
				continue
			}
			config.VerifyPeerCertByName = append(config.VerifyPeerCertByName, v)
		}
	}

	if c.ECHServerKeys != "" {
		EchPrivateKey, err := base64.StdEncoding.DecodeString(c.ECHServerKeys)
		if err != nil {
			return nil, errors.New("invalid ECH Config", c.ECHServerKeys)
		}
		config.EchServerKeys = EchPrivateKey
	}
	config.EchConfigList = c.ECHConfigList
	if c.ECHSocketSettings != nil {
		ss, err := c.ECHSocketSettings.Build()
		if err != nil {
			return nil, errors.New("Failed to build ech sockopt.").Base(err)
		}
		config.EchSocketSettings = ss
	}

	return config, nil
}

View on GitHub (pinned to 7d214f8b09)