ruvnet/RuView · error · ValueError
Confidence threshold must be between 0.0 and 1.0
Error message
Confidence threshold must be between 0.0 and 1.0
What it means
Pydantic v2 @field_validator on Settings.pose_confidence_threshold in archive/v1/src/config/settings.py. It enforces 0.0 <= value <= 1.0; values outside that range raise ValueError when Settings is constructed, aborting startup. Like the domain-level threshold validator, this expects a fraction — percentage conventions (0-100) are the most common cause of failure.
Source
Thrown at archive/v1/src/config/settings.py:199
if v not in allowed_environments:
raise ValueError(f"Environment must be one of: {allowed_environments}")
return v
@field_validator("log_level")
@classmethod
def validate_log_level(cls, v):
"""Validate log level setting."""
allowed_levels = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
if v.upper() not in allowed_levels:
raise ValueError(f"Log level must be one of: {allowed_levels}")
return v.upper()
@field_validator("pose_confidence_threshold")
@classmethod
def validate_confidence_threshold(cls, v):
"""Validate confidence threshold."""
if not 0.0 <= v <= 1.0:
raise ValueError("Confidence threshold must be between 0.0 and 1.0")
return v
@field_validator("stream_fps")
@classmethod
def validate_stream_fps(cls, v):
"""Validate streaming FPS."""
if not 1 <= v <= 60:
raise ValueError("Stream FPS must be between 1 and 60")
return v
@field_validator("port")
@classmethod
def validate_port(cls, v):
"""Validate port number."""
if not 1 <= v <= 65535:
raise ValueError("Port must be between 1 and 65535")
return v
View on GitHub (pinned to 4685618388)
Solutions
- Set POSE_CONFIDENCE_THRESHOLD to a fraction in [0.0, 1.0] (85% -> 0.85)
- To disable confidence filtering, use 0.0 rather than a negative value
- Clamp operator-supplied values before they reach Settings if the input source is untrusted
- Keep the fraction convention documented in the .env template
Example fix
# before POSE_CONFIDENCE_THRESHOLD=85 # after POSE_CONFIDENCE_THRESHOLD=0.85
Defensive patterns
Strategy: validation
Validate before calling
raw = float(os.environ.get("POSE_CONFIDENCE_THRESHOLD", "0.5"))
assert 0.0 <= raw <= 1.0, f"POSE_CONFIDENCE_THRESHOLD must be a fraction in [0,1], got {raw} (did you mean {raw / 100}?)" Type guard
def is_unit_fraction(v) -> bool:
return isinstance(v, (int, float)) and not isinstance(v, bool) and 0.0 <= float(v) <= 1.0 Try / catch
from pydantic import ValidationError
try:
settings = Settings()
except ValidationError as e:
if any(err["loc"][-1] == "pose_confidence_threshold" for err in e.errors()):
raise SystemExit("pose_confidence_threshold must be 0.0-1.0 (fractions, not percentages)") from e
raise Prevention
- Store thresholds as fractions in env files; document that 0.85 means 85%
- Sanity-check magnitude: values > 1 almost always mean a percentage slipped in
- Clamp operator input before it reaches Settings when the source is untrusted
When it happens
Trigger: POSE_CONFIDENCE_THRESHOLD=85 (percentage convention); =-1 attempting to disable filtering; =1.5 during tuning to 'see everything'; =0.0..1.0 works, so anything outside indicates a unit or typo problem.
Common situations: Env files authored with percentages; values copied from tools that use 0-100 scales; tuning experiments that push the bound past 1.0.
Related errors
- Environment must be one of: {allowed_environments}
- Log level must be one of: {allowed_levels}
- Stream FPS must be between 1 and 60
- Port must be between 1 and 65535
- Workers must be at least 1
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/bcb1d4106ec1e8f6.
Report an issue: GitHub.