ATH-MaaS/Pixelle-Video · error · ValueError
Unknown media type: {media_result.media_type}
Error message
Unknown media type: {media_result.media_type} What it means
In _step_generate_media, after media generation the code branches on media_result.media_type (expected 'image' or 'video'); anything else falls into the final else and raises ValueError. This is an internal contract check: MediaResult.media_type must hold a known media kind for the frame pipeline to know whether to measure duration and log accordingly.
Source
Thrown at pixelle_video/services/frame_processor.py:278
local_path = await self._download_media(
media_result.url,
frame.index,
config.task_id,
media_type="video"
)
frame.video_path = local_path
# Update duration from video if available
if media_result.duration:
frame.duration = media_result.duration
logger.debug(f" ✓ Video generated: {local_path} (duration: {frame.duration:.2f}s)")
else:
# Get video duration from file
frame.duration = await self._get_video_duration(local_path)
logger.debug(f" ✓ Video generated: {local_path} (duration: {frame.duration:.2f}s)")
else:
raise ValueError(f"Unknown media type: {media_result.media_type}")
async def _prepare_api_video_inputs(
self,
frame: StoryboardFrame,
config: StoryboardConfig,
api_video_params: dict,
) -> None:
"""Prepare provider-specific inputs for API video models."""
from pixelle_video.utils.os_util import get_task_frame_path
if api_video_params.pop("use_narration_audio_as_driving_audio", False):
api_video_params["audio_path"] = frame.audio_path
if frame.image_path or api_video_params.get("first_clip_path") or api_video_params.get("first_video_path"):
return
first_frame_workflow = api_video_params.pop("first_frame_workflow", None)
if not first_frame_workflow:View on GitHub (pinned to 848b054e4f)
Solutions
- Log/inspect media_result.media_type at the failure point and confirm it is exactly 'image' or 'video' (case-sensitive).
- Normalize the value before the branch: media_type = media_result.media_type.strip().lower().
- If a new media type is legitimately produced upstream, add an elif branch handling it (e.g. audio duration measurement) in _step_generate_media.
- Add a validation/whitelist check on media_type when constructing MediaResult so bad values fail early.
Example fix
// before
else:
raise ValueError(f"Unknown media type: {media_result.media_type}")
// after
media_type = (media_result.media_type or "").strip().lower()
if media_type == "image":
...
elif media_type == "video":
...
else:
raise ValueError(f"Unknown media type: {media_result.media_type!r}") Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = {"image", "video"}
def check_media_type(media_result) -> str:
mt = (getattr(media_result, "media_type", "") or "").strip().lower()
if mt not in ALLOWED:
raise ValueError(f"Unsupported media_type before pipeline: {media_result.media_type!r}")
return mt
check_media_type(media_result) # call before processor pipeline Type guard
def is_known_media_result(mt: object) -> bool:
return isinstance(mt, str) and mt.strip().lower() in {"image", "video"} Try / catch
try:
await processor(storyboard, config)
except ValueError as e:
if "Unknown media type" in str(e):
logger.error("media_type contract broken: %s", e)
# fix/normalize storyboard or upgrade library
else:
raise Prevention
- Normalize media_type to lowercase at the boundary where MediaResult is created.
- Use an enum/Literal type for media_type so invalid values cannot be constructed.
- When upgrading providers, diff their returned media kinds against the processor's supported set.
When it happens
Trigger: Calling the frame processor's pipeline (__call__ -> _step_generate_media) with a MediaResult whose media_type string is not exactly 'image' or 'video' — e.g. 'audio', 'Image' (case mismatch), an empty string, or a new upstream media kind added without updating this branch.
Common situations: Upstream API or provider enum changed/added a media type (e.g. 'audio' or 'tts') not handled here; manual construction of MediaResult in tests with a typo'd type; case-sensitive comparison against mixed-case input.
Related errors
- Unknown media type: {frame.media_type}
- Progress must be between 0.0 and 1.0, got {self.progress}
- frame_template is required to determine media size
- No assets provided. Please upload at least one image or vide
- Unknown pipeline: '{pipeline}'. Available pipelines: {availa
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/a88c97b3bc5e6425.
Report an issue: GitHub.