ruvnet/RuView · error · ValueError
Interval seconds must be non-negative
Error message
Interval seconds must be non-negative
What it means
Raised by the shared Pydantic field_validator validate_interval_seconds in archive/v1/src/config/settings.py. It applies to three fields at once: monitoring_interval_seconds (default 60), cleanup_interval_seconds (default 3600), and backup_interval_seconds (default 86400). Any of them set below 0 raises ValueError at Settings instantiation; 0 itself is allowed (means the task is disabled).
Source
Thrown at archive/v1/src/config/settings.py:255
"""Validate Redis port."""
if not 1 <= v <= 65535:
raise ValueError("Redis port must be between 1 and 65535")
return v
@field_validator("db_pool_size")
@classmethod
def validate_db_pool_size(cls, v):
"""Validate database pool size."""
if v < 1:
raise ValueError("Database pool size must be at least 1")
return v
@field_validator("monitoring_interval_seconds", "cleanup_interval_seconds", "backup_interval_seconds")
@classmethod
def validate_interval_seconds(cls, v):
"""Validate interval settings."""
if v < 0:
raise ValueError("Interval seconds must be non-negative")
return v
@property
def is_development(self) -> bool:
"""Check if running in development environment."""
return self.environment == "development"
@property
def is_production(self) -> bool:
"""Check if running in production environment."""
return self.environment == "production"
@property
def is_testing(self) -> bool:
"""Check if running in testing environment."""
return self.environment == "testing"
def get_database_url(self) -> str:
"""Get database URL with fallback."""View on GitHub (pinned to 4685618388)
Solutions
- Set the offending interval to 0 to disable that task, or to a positive number of seconds.
- Identify which of the three env vars is negative: inspect MONITORING_INTERVAL_SECONDS, CLEANUPING_INTERVAL_SECONDS-style spellings, and BACKUP_INTERVAL_SECONDS in the environment (note the message does not name the field, so check all three).
- Sanitize computed values before they reach Settings: `value = max(0, computed_interval)`.
- If you use -1 as a disable flag, translate it to 0 at the config layer: `interval if interval > 0 else 0`.
Example fix
# before CLEANUP_INTERVAL_SECONDS=-1 # after CLEANUP_INTERVAL_SECONDS=0 # 0 disables the task; negatives are rejected
Defensive patterns
Strategy: validation
Validate before calling
INTERVAL_VARS = ('MONITORING_INTERVAL_SECONDS', 'CLEANUP_INTERVAL_SECONDS', 'BACKUP_INTERVAL_SECONDS')
for var in INTERVAL_VARS:
if var in os.environ:
val = int(os.environ[var])
if val < 0:
raise SystemExit(f'{var}={val} is negative; use 0 to disable the task') Try / catch
from pydantic import ValidationError
try:
settings = Settings()
except ValidationError as e:
if any('interval_seconds' in ''.join(map(str, err['loc'])) for err in e.errors()):
print('One of MONITORING/CLEANUP/BACKUP_INTERVAL_SECONDS is negative; 0 disables')
raise Prevention
- Use 0 (not -1) as the disable convention for all three interval vars.
- Lint env files for negative numbers anywhere.
- When intervals are computed, clamp to max(0, value) at the boundary.
When it happens
Trigger: Setting MONITORING_INTERVAL_SECONDS, CLEANUP_INTERVAL_SECONDS, or BACKUP_INTERVAL_SECONDS to a negative number in the environment before creating the Settings object. All three validators run even if only one interval is misconfigured, and the error message does not say which field triggered it.
Common situations: Using -1 as a convention for disabled tasks; template math like `60 * -1` or `${interval:-60}` typos producing negative values; Kubernetes ConfigMap values pasted with a stray minus sign; using seconds where minutes were intended (e.g. -0.5 from a unit-conversion script).
Related errors
- Database port must be between 1 and 65535
- Redis port must be between 1 and 65535
- Threshold must be between 0.0 and 1.0
- FPS must be between 1 and 60
- Compression level must be between 1 and 9
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/e3ba7bf808e0cd3d.
Report an issue: GitHub.