{"record":{"id":"d80e45eae48dfdff","repo":"vitessio/vitess","slug":"target-replication-lag-sec-must-not-be-higher-than","errorCode":null,"errorMessage":"target_replication_lag_sec must not be higher than max_replication_lag_sec: invalid: %v > %v","messagePattern":"target_replication_lag_sec must not be higher than max_replication_lag_sec: invalid: (.+?) > (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/throttler/max_replication_lag_module_config.go","lineNumber":93,"sourceCode":"func NewMaxReplicationLagModuleConfig(maxReplicationLag int64) MaxReplicationLagModuleConfig {\n\tconfig := defaultMaxReplicationLagModuleConfig.Clone()\n\tconfig.MaxReplicationLagSec = maxReplicationLag\n\treturn config\n}\n\n// TODO(mberlin): Add method which updates the config using a (partially) filled\n// in protobuf.\n\n// Verify returns an error if the config is invalid.\nfunc (cfg MaxReplicationLagModuleConfig) Verify() error {\n\tif cfg.TargetReplicationLagSec < 1 {\n\t\treturn errors.New(\"target_replication_lag_sec must be >= 1\")\n\t}\n\tif cfg.MaxReplicationLagSec < 2 {\n\t\treturn errors.New(\"max_replication_lag_sec must be >= 2\")\n\t}\n\tif cfg.TargetReplicationLagSec > cfg.MaxReplicationLagSec {\n\t\treturn fmt.Errorf(\"target_replication_lag_sec must not be higher than max_replication_lag_sec: invalid: %v > %v\",\n\t\t\tcfg.TargetReplicationLagSec, cfg.MaxReplicationLagSec)\n\t}\n\tif cfg.InitialRate < 1 {\n\t\treturn errors.New(\"initial_rate must be >= 1\")\n\t}\n\tif cfg.MaxIncrease <= 0 {\n\t\treturn errors.New(\"max_increase must be > 0\")\n\t}\n\tif cfg.EmergencyDecrease <= 0 {\n\t\treturn errors.New(\"emergency_decrease must be > 0\")\n\t}\n\tif cfg.MinDurationBetweenIncreasesSec < 1 {\n\t\treturn errors.New(\"min_duration_between_increases_sec must be >= 1\")\n\t}\n\tif cfg.MaxDurationBetweenIncreasesSec < 1 {\n\t\treturn errors.New(\"max_duration_between_increases_sec must be >= 1\")\n\t}\n\tif cfg.MinDurationBetweenDecreasesSec < 1 {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/throttler/max_replication_lag_module_config.go#L75-L111","documentation":"Returned by throttler config validation when target_replication_lag_sec exceeds max_replication_lag_sec, which is an inconsistent configuration; both values must satisfy target <= max.","triggerScenarios":"Constructing MaxReplicationLagModuleConfig with TargetReplicationLagSec > MaxReplicationLagSec and calling Verify() (via NewMaxReplicationLagModule or newThrottlerFromConfig). Also fires when MaxReplicationLagSec < 2 validation order puts target above an already-too-small max.","commonSituations":"Operators set a tight target_replication_lag_sec (e.g. 5) but forgot to raise max_replication_lag_sec (e.g. left at 2), or disabled lag throttling on one field but not the other.","solutions":["Raise max_replication_lag_sec to be >= target_replication_lag_sec.","Lower target_replication_lag_sec to be <= max_replication_lag_sec.","Call Verify() on your config early (at flag-parsing time) to fail fast with a clear message."],"exampleFix":"// before\nMaxReplicationLagSec: 2, TargetReplicationLagSec: 10 // 10 > 2 -> error\n// after\nMaxReplicationLagSec: 10, TargetReplicationLagSec: 5","handlingStrategy":"validation","validationCode":"if cfg.TargetReplicationLagSec > cfg.MaxReplicationLagSec {\n    return errors.New(\"target_replication_lag_sec must be <= max_replication_lag_sec\")\n}\nif err := cfg.Verify(); err != nil { return err }","typeGuard":null,"tryCatchPattern":"if err := cfg.Verify(); err != nil {\n    return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, \"bad throttler config: %v\", err)\n}","preventionTips":["Pick target as a fraction of max (e.g. target = max/2) in your config templates.","Validate both fields together at flag-parse time.","Document units (seconds) in tooling so operators don't mix ms and s."],"tags":["go","throttler","config-validation"],"backgroundTag":"throttler-config-invalid","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}