XTLS/Xray-core · error
invalid mKCP TTI:
Error message
invalid mKCP TTI:
What it means
Thrown by KCPConfig.Build() when the mKCP TTI (transmission time interval, in milliseconds) is outside the accepted 10-1000 range. TTI controls how often mKCP flushes packets; values below 10 ms waste CPU and values above 1000 ms stall the link, so the builder rejects both. The offending value is included in the message.
Solutions
- Set tti between 10 and 1000 inclusive (10, 20, 30, 40, 50 are the conventional choices).
- Remove the tti field to use the default (50).
Example fix
// before
"kcpSettings": { "mtu": 1350, "tti": 5000 }
// after
"kcpSettings": { "mtu": 1350, "tti": 50 } Defensive patterns
Strategy: validation
Validate before calling
if kcp.Tti != 0 && (kcp.Tti < 10 || kcp.Tti > 1000) {
return fmt.Errorf("mKCP tti %d outside 10-1000", kcp.Tti)
} Try / catch
if _, err := kcpCfg.Build(); err != nil && strings.HasPrefix(err.Error(), "invalid mKCP TTI") {
return fmt.Errorf("fix tti (10-1000 ms): %w", err)
} Prevention
- Offer users a fixed set of tti presets (10/20/30/40/50) instead of free input.
- Range-check tti wherever configs are edited programmatically.
When it happens
Trigger: Setting kcpSettings.tti to something like 5 or 2000 in the JSON config. Note there is no lower-bound protection for the zero value if the field is absent only when the default is applied; an explicitly bad value always trips this.
Common situations: Users copying tti from old docs suggesting aggressive values (e.g. 1ms 'low latency' tweaks), or fat-fingered values like 10000.
Related errors
- CwndMultiplier must be at least 1
- MaxSendingWindow must be >= Mtu
- Mtu must be at least 21
- Config: unknown transport protocol: + p
- empty stunServers
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/84b50380e5760e35.
Report an issue: GitHub.
Appendix: source
Thrown at infra/conf/transport_method.go:566
}
if c.UpCap != nil {
config.UplinkCapacity = *c.UpCap
}
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"`View on GitHub (pinned to 7d214f8b09)