ATH-MaaS/Pixelle-Video · error · ValueError

Progress must be between 0.0 and 1.0, got {self.progress}

Error message

Progress must be between 0.0 and 1.0, got {self.progress}

What it means

ProgressEvent.__post_init__ (pixelle_video/models/progress.py:60-63) validates that the progress dataclass field is a float in [0.0, 1.0] and raises ValueError otherwise. This dataclass invariant guarantees every progress event consumers receive is a normalized fraction; passing raw percentages (0-100) or negative values violates it.

Source

Thrown at pixelle_video/models/progress.py:63

            frame_total=5,
            step=1,
            action="audio"
        )
    """
    event_type: str
    progress: float
    
    # Optional frame-related fields
    frame_current: Optional[int] = None
    frame_total: Optional[int] = None
    step: Optional[int] = None  # 1-4 for frame processing steps
    action: Optional[str] = None  # "audio", "image", "compose", "video"
    extra_info: Optional[str] = None  # Additional information (e.g., batch progress)
    
    def __post_init__(self):
        """Validate progress value"""
        if not 0.0 <= self.progress <= 1.0:
            raise ValueError(f"Progress must be between 0.0 and 1.0, got {self.progress}")

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Divide by the total before constructing: ProgressEvent(progress=done/total)
  2. If the source reports percentages, convert with progress/100.0 before passing it
  3. Clamp to the valid range at the boundary: max(0.0, min(1.0, value))
  4. Add a unit test for your progress callback asserting all emitted values are within [0.0, 1.0]

Example fix

# before
ProgressEvent(action="image", progress=step_pct)  # e.g. 42
# after
ProgressEvent(action="image", progress=step_pct / 100.0)  # 0.42
Defensive patterns

Strategy: validation

Validate before calling

def make_progress(action: str, done: int, total: int) -> "ProgressEvent":
    if total <= 0:
        raise ValueError("total must be positive")
    return ProgressEvent(action=action, progress=max(0.0, min(1.0, done / total)))

Type guard

def is_valid_progress(value) -> bool:
    return isinstance(value, (int, float)) and 0.0 <= float(value) <= 1.0

Try / catch

try:
    event = ProgressEvent(action="compose", progress=raw_value)
except ValueError as e:
    if "Progress must be between" in str(e):
        event = ProgressEvent(action="compose", progress=max(0.0, min(1.0, float(raw_value))))
    else:
        raise

Prevention

When it happens

Trigger: Constructing ProgressEvent(progress=...) with a value outside 0.0-1.0 — e.g. progress=50 (percentage instead of fraction), progress=1 (int equal to 1 is fine, but 1.5 or 100 fails), or a negative number; typically in a progress callback wiring task_manager.update_progress to a pipeline that reports percentages.

Common situations: Adapters converting ComfyUI/node batch progress from percent to fraction incorrectly or not at all; off-by-one progress like n_steps instead of n_steps/total; custom code emitting progress=progress*100 double-scaling an already-normalized value.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/244c2e9cf1da06b5. Report an issue: GitHub.