{"record":{"id":"1107dea77ba36a6d","repo":"langchain-ai/deepagents","slug":"no-frames-decoded-for-window-offset-seconds-3f","errorCode":null,"errorMessage":"No frames decoded for window [{offset_seconds:.3f}s, {end_seconds:.3f}s)","messagePattern":"No frames decoded for window \\[(.+?)s, (.+?)s\\)","errorType":"exception","errorClass":"VideoExtractionError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/middleware/_video.py","lineNumber":198,"sourceCode":"                    offset_seconds=offset_seconds,\n                    duration_seconds=float(duration),\n                    sampling_rate=rate,\n                    time_base=time_base,\n                    stream_start_seconds=stream_start_seconds,\n                    deadline_seconds=time.monotonic() + MAX_VIDEO_DECODE_SECONDS,\n                    decode_error_types=backend_error_types,\n                )\n            )\n        except backend_error_types as exc:\n            msg = f\"Failed to decode video frames: {exc}\"\n            raise VideoExtractionError(msg) from exc\n    finally:\n        container.close()\n\n    if not blocks:\n        end_seconds = offset_seconds + duration\n        msg = f\"No frames decoded for window [{offset_seconds:.3f}s, {end_seconds:.3f}s)\"\n        raise VideoExtractionError(msg)\n    return blocks\n\n\ndef _validate_video_window(*, offset_seconds: float, duration_seconds: float, sampling_rate: float) -> None:\n    \"\"\"Validate the requested sampling window before opening the video.\"\"\"\n    if offset_seconds < 0:\n        msg = f\"offset_seconds must be >= 0, got {offset_seconds!r}\"\n        raise ValueError(msg)\n    if sampling_rate <= 0:\n        msg = f\"sampling_rate must be > 0, got {sampling_rate!r}\"\n        raise ValueError(msg)\n    if duration_seconds <= 0:\n        msg = f\"duration_seconds must be > 0, got {duration_seconds!r}\"\n        raise ValueError(msg)\n\n\ndef _open_video_container(av: Any, content: bytes) -> Any:  # noqa: ANN401  # PyAV types are unavailable without the [video] extra\n    \"\"\"Open a video byte payload, normalizing PyAV's failure modes.","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/middleware/_video.py#L180-L216","documentation":"After decoding the requested window, if no frames were produced at all, extract_video_frames raises VideoExtractionError naming the window. This distinguishes 'seek/decode produced nothing' from other failures and prevents silently returning empty results.","triggerScenarios":"extract_video_frames with an offset_seconds beyond the end of the video, a video shorter than the requested offset, or streams that decode zero frames in the requested range.","commonSituations":"Requesting frames at 10 minutes of a 30-second clip; agents guessing timestamps; windows computed with wrong unit conversions (e.g. seconds-vs-milliseconds).","solutions":["Probe the video duration (ffprobe / container.duration) and clamp the window inside it.","Use offset_seconds=0 with a small duration to verify frames exist at all.","Correct unit conversions so the window is in seconds.","Catch VideoExtractionError and retry from the start of the video."],"exampleFix":"// before\nframes = extract_video_frames(content, offset_seconds=600.0, duration_seconds=5.0)  # 10s video\n// after\nduration = get_video_duration(content)\noffset = min(600.0, max(0.0, duration - 1.0))\nframes = extract_video_frames(content, offset_seconds=offset, duration_seconds=1.0)","handlingStrategy":"validation","validationCode":"def window_inside_duration(offset_seconds: float, duration_seconds: float, media_duration: float) -> bool:\n    return offset_seconds >= 0 and offset_seconds + duration_seconds <= media_duration and media_duration > 0","typeGuard":null,"tryCatchPattern":"try:\n    frames = extract_video_frames(content, offset_seconds=offset, duration_seconds=duration)\nexcept VideoExtractionError as exc:\n    if str(exc).startswith(\"No frames decoded\"):\n        frames = extract_video_frames(content, offset_seconds=0.0, duration_seconds=min(duration, media_duration))\n    else:\n        raise","preventionTips":["Read container.duration and clamp the requested window to [0, duration).","Never trust agent-guessed timestamps; derive them from probe metadata.","Fix unit conversions (ms vs s) in callers computing windows.","For short clips, default to a window starting at 0."],"tags":["video","empty-result","pyav"],"backgroundTag":"no-frames-decoded","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}