XTLS/Xray-core · error

CwndMultiplier must be at least 1

Error message

CwndMultiplier must be at least 1

What it means

Thrown by KCPConfig.Build() when CwndMultiplier is less than 1. The multiplier scales the congestion window relative to the receive window; a value of 0 or negative makes the send window empty and no data can ever be transmitted. Defaults to 2 when unset.

Source

Thrown at infra/conf/transport_method.go:569

	}
	if c.DownCap != nil {
		config.DownlinkCapacity = *c.DownCap
	}
	if c.CwndMultiplier != nil {
		config.CwndMultiplier = *c.CwndMultiplier
	}
	if c.MaxSendingWindow != nil {
		config.MaxSendingWindow = *c.MaxSendingWindow
	}

	if config.Mtu < 21 {
		return nil, errors.New("Mtu must be at least 21").AtError()
	}
	if config.Tti < 10 || config.Tti > 1000 {
		return nil, errors.New("invalid mKCP TTI: ", c.Tti).AtError()
	}
	if config.CwndMultiplier < 1 {
		return nil, errors.New("CwndMultiplier must be at least 1").AtError()
	}
	if config.GetSendingBufferSize() == 0 {
		return nil, errors.New("MaxSendingWindow must be >= Mtu").AtError()
	}

	return config, nil
}

type GRPCConfig struct {
	Authority           string `json:"authority"`
	ServiceName         string `json:"serviceName"`
	MultiMode           bool   `json:"multiMode"`
	IdleTimeout         int32  `json:"idle_timeout"`
	HealthCheckTimeout  int32  `json:"health_check_timeout"`
	PermitWithoutStream bool   `json:"permit_without_stream"`
	InitialWindowsSize  int32  `json:"initial_windows_size"`
	UserAgent           string `json:"user_agent"`
}

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Set cwndMultiplier to 1 or higher (default 2 is recommended).
  2. Remove the field entirely to accept the default.

Example fix

// before
"kcpSettings": { "cwndMultiplier": 0 }
// after
"kcpSettings": { "cwndMultiplier": 2 }
Defensive patterns

Strategy: validation

Validate before calling

if kcp.CwndMultiplier != nil && *kcp.CwndMultiplier < 1 {
    return errors.New("cwndMultiplier must be >= 1")
}

Try / catch

if _, err := kcpCfg.Build(); err != nil && strings.Contains(err.Error(), "CwndMultiplier") {
    cfg.CwndMultiplier = nil // fall back to default
    _, err = cfg.Build()
}

Prevention

When it happens

Trigger: Explicitly setting kcpSettings.cwndMultiplier to 0 or a negative number in the JSON config.

Common situations: Attempting to disable congestion control by setting the multiplier to 0, or misreading the field as a boolean/percentage.

Related errors


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