vitessio/vitess · error
invalid max replication lag config: %w
Error message
invalid max replication lag config: %w
What it means
newThrottlerFromConfig calls Verify() on the MaxReplicationLagModuleConfig before constructing the throttler and wraps any failure with 'invalid max replication lag config'. Throttler creation is aborted because the replication-lag module settings are invalid.
Source
Thrown at go/vt/throttler/throttler.go:163
func NewThrottler(name, unit string, threadCount int, maxRate, maxReplicationLag int64) (Throttler, error) {
return newThrottler(GlobalManager, name, unit, threadCount, maxRate, maxReplicationLag, time.Now)
}
func NewThrottlerFromConfig(name, unit string, threadCount int, maxRateModuleMaxRate int64, maxReplicationLagModuleConfig MaxReplicationLagModuleConfig, nowFunc func() time.Time) (Throttler, error) {
return newThrottlerFromConfig(GlobalManager, name, unit, threadCount, maxRateModuleMaxRate, maxReplicationLagModuleConfig, nowFunc)
}
func newThrottler(manager *managerImpl, name, unit string, threadCount int, maxRate, maxReplicationLag int64, nowFunc func() time.Time) (Throttler, error) {
config := NewMaxReplicationLagModuleConfig(maxReplicationLag)
config.MaxReplicationLagSec = maxReplicationLag
return newThrottlerFromConfig(manager, name, unit, threadCount, maxRate, config, nowFunc)
}
func newThrottlerFromConfig(manager *managerImpl, name, unit string, threadCount int, maxRateModuleMaxRate int64, maxReplicationLagModuleConfig MaxReplicationLagModuleConfig, nowFunc func() time.Time) (Throttler, error) {
err := maxReplicationLagModuleConfig.Verify()
if err != nil {
return nil, fmt.Errorf("invalid max replication lag config: %w", err)
}
if maxRateModuleMaxRate < 0 {
return nil, fmt.Errorf("maxRate must be >= 0: %v", maxRateModuleMaxRate)
}
// Enable the configured modules.
maxRateModule := NewMaxRateModule(maxRateModuleMaxRate)
actualRateHistory := newAggregatedIntervalHistory(1024, 1*time.Second, threadCount)
maxReplicationLagModule, err := NewMaxReplicationLagModule(maxReplicationLagModuleConfig, actualRateHistory, nowFunc)
if err != nil {
return nil, err
}
modules := make([]Module, 0, 2)
modules = append(modules, maxRateModule)
modules = append(modules, maxReplicationLagModule)
// Start each module (which might start own Go routines).View on GitHub (pinned to 01a25a7d17)
Solutions
- Inspect the wrapped error (%w) to identify the exact invalid field.
- Correct the max_replication_lag_module config values per Verify() constraints.
- Call MaxReplicationLagModuleConfig.Verify() in your config-loading code before NewThrottlerFromConfig to fail fast.
Example fix
// before
config.TargetReplicationLagSec = 0
throttler.NewThrottlerFromConfig(mgr, name, unit, 1, 100, config, nowFunc)
// after
config.TargetReplicationLagSec = 1
config.MaxReplicationLagSec = 10
if err := config.Verify(); err != nil { return err }
throttler.NewThrottlerFromConfig(mgr, name, unit, 1, 100, config, nowFunc) Defensive patterns
Strategy: validation
Validate before calling
if err := cfg.Verify(); err != nil {
return fmt.Errorf("invalid max replication lag config: %w", err)
} Try / catch
t, err := throttler.NewThrottlerFromConfig(mgr, name, unit, threads, maxRate, cfg, nowFunc)
if err != nil {
return vterrors.Wrapf(err, "creating throttler %s", name)
} Prevention
- Run Verify() at config-load/flag-parse time, before throttler creation.
- Add unit tests covering the zero-value config for your service.
- Keep topology-stored throttler settings schema-checked on read.
When it happens
Trigger: NewThrottlerFromConfig or newThrottler invoked with a config whose fields violate Verify() (target/max lag bounds, initial_rate < 1, non-positive max-increase, etc.).
Common situations: vreplication/vstreamer constructing a throttler from vtctld flags or topology-stored settings; a malformed --throttler-config-* flag or bad JSON in the topo.
Related errors
- invalid NewMaxReplicationLagModuleConfig: %v
- target_replication_lag_sec must not be higher than max_repli
- maxRate must be >= 0: %v
- ignoring higher good rate of %v because we assume that the k
- ignoring lower bad rate of %v because such a high degradatio
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/56b61ab6ff89fb1a.
Report an issue: GitHub.