{"record":{"id":"244c2e9cf1da06b5","repo":"ATH-MaaS/Pixelle-Video","slug":"progress-must-be-between-0-0-and-1-0-got-self-pr","errorCode":null,"errorMessage":"Progress must be between 0.0 and 1.0, got {self.progress}","messagePattern":"Progress must be between 0\\.0 and 1\\.0, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pixelle_video/models/progress.py","lineNumber":63,"sourceCode":"            frame_total=5,\n            step=1,\n            action=\"audio\"\n        )\n    \"\"\"\n    event_type: str\n    progress: float\n    \n    # Optional frame-related fields\n    frame_current: Optional[int] = None\n    frame_total: Optional[int] = None\n    step: Optional[int] = None  # 1-4 for frame processing steps\n    action: Optional[str] = None  # \"audio\", \"image\", \"compose\", \"video\"\n    extra_info: Optional[str] = None  # Additional information (e.g., batch progress)\n    \n    def __post_init__(self):\n        \"\"\"Validate progress value\"\"\"\n        if not 0.0 <= self.progress <= 1.0:\n            raise ValueError(f\"Progress must be between 0.0 and 1.0, got {self.progress}\")\n\n","sourceCodeStart":45,"sourceCodeEnd":65,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/models/progress.py#L45-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Divide by the total before constructing: ProgressEvent(progress=done/total)","If the source reports percentages, convert with progress/100.0 before passing it","Clamp to the valid range at the boundary: max(0.0, min(1.0, value))","Add a unit test for your progress callback asserting all emitted values are within [0.0, 1.0]"],"exampleFix":"# before\nProgressEvent(action=\"image\", progress=step_pct)  # e.g. 42\n# after\nProgressEvent(action=\"image\", progress=step_pct / 100.0)  # 0.42","handlingStrategy":"validation","validationCode":"def make_progress(action: str, done: int, total: int) -> \"ProgressEvent\":\n    if total <= 0:\n        raise ValueError(\"total must be positive\")\n    return ProgressEvent(action=action, progress=max(0.0, min(1.0, done / total)))","typeGuard":"def is_valid_progress(value) -> bool:\n    return isinstance(value, (int, float)) and 0.0 <= float(value) <= 1.0","tryCatchPattern":"try:\n    event = ProgressEvent(action=\"compose\", progress=raw_value)\nexcept ValueError as e:\n    if \"Progress must be between\" in str(e):\n        event = ProgressEvent(action=\"compose\", progress=max(0.0, min(1.0, float(raw_value))))\n    else:\n        raise","preventionTips":["Always normalize progress to a 0.0-1.0 fraction before constructing ProgressEvent","Convert percent-based sources with value/100.0 at the adapter boundary","Clamp with max(0.0, min(1.0, value)) when the source can overshoot (float rounding, race conditions)","Unit-test progress emitters to assert all values fall within [0.0, 1.0]"],"tags":["python","validation","dataclass","progress"],"backgroundTag":"value-out-of-range","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}