SigNoz/signoz · error
ErrCodeInvalidSQLMigratorConfig
ErrCodeInvalidSQLMigratorConfig
Error message
lock::timeout must be greater than lock::interval
What it means
sqlmigrator's Config.Validate enforces that the migration advisory lock timeout is strictly greater than the lock polling interval. If timeout <= interval, migrations would effectively get at most one (or zero) retry attempts, so the config is rejected as invalid.
Source
Thrown at pkg/sqlmigrator/config.go:43
Interval time.Duration `mapstructure:"interval"`
}
func NewConfigFactory() factory.ConfigFactory {
return factory.NewConfigFactory(factory.MustNewName("sqlmigrator"), newConfig)
}
func newConfig() factory.Config {
return Config{
Lock: Lock{
Timeout: 2 * time.Minute,
Interval: 10 * time.Second,
},
}
}
func (c Config) Validate() error {
if c.Lock.Timeout <= c.Lock.Interval {
return errors.New(errors.TypeInvalidInput, ErrCodeInvalidSQLMigratorConfig, "lock::timeout must be greater than lock::interval")
}
return nil
}
View on GitHub (pinned to 5069bf80b0)
Solutions
- Set Lock.Timeout strictly greater than Lock.Interval (e.g. interval=5s, timeout=1m)
- Call Config.Validate() at startup or in tests to catch misconfiguration early
- Double-check unit consistency of both fields (both are time.Duration)
Example fix
// before
cfg := sqlmigrator.Config{Lock: sqlmigrator.LockConfig{Timeout: 10 * time.Second, Interval: 10 * time.Second}}
// after
cfg := sqlmigrator.Config{Lock: sqlmigrator.LockConfig{Timeout: 1 * time.Minute, Interval: 5 * time.Second}} Defensive patterns
Strategy: validation
Validate before calling
if err := cfg.Validate(); err != nil {
log.Fatal(err)
} Try / catch
if err := cfg.Validate(); err != nil {
return fmt.Errorf("invalid migrator config: %w", err)
} Prevention
- Call Validate() in unit tests for every config construction site
- Centralize lock defaults in one constructor so timeout/interval stay consistent
When it happens
Trigger: Building a sqlmigrator with Lock.Timeout <= Lock.Interval, e.g. timeout=10s and interval=10s, or interval unset/zero combined with timeout zero.
Common situations: Copying defaults from another project, setting interval in milliseconds while timeout in seconds, or zero-valuing both fields which fails the <= check.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/fee3fe002372919e.
Report an issue: GitHub.