{"record":{"id":"a291bf3853772359","repo":"langchain-ai/deepagents","slug":"unsupported-outbound-media-file-type-path","errorCode":null,"errorMessage":"unsupported outbound media file type: {path}","messagePattern":"unsupported outbound media file type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/media.py","lineNumber":185,"sourceCode":"        root: Optional directory that must contain the referenced media. When\n            supplied, Markdown references must be relative paths resolved inside\n            this root.\n\n    Returns:\n        Channel media payload.\n\n    Raises:\n        ValueError: If the referenced path is unsafe or is not an image or video.\n    \"\"\"\n    path = (\n        resolve_bounded_media_path(ref.path, root, require_relative=True)\n        if root is not None\n        else ref.path.expanduser()\n    )\n    media_type = _outbound_media_type(path)\n    if media_type is None:\n        msg = f\"unsupported outbound media file type: {path}\"\n        raise ValueError(msg)\n    return ChannelMedia(path=path, media_type=media_type, caption=caption)\n\n\ndef resolve_bounded_media_path(\n    path: Path,\n    root: Path,\n    *,\n    require_relative: bool = False,\n) -> Path:\n    \"\"\"Resolve a local media path and enforce containment under a trusted root.\n\n    Args:\n        path: Candidate media path.\n        root: Directory that must contain the media after symlink resolution.\n        require_relative: Whether to reject absolute candidate paths up front.\n\n    Returns:\n        Canonical media path under `root`.","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/media.py#L167-L203","documentation":"ValueError raised by outbound_channel_media when the referenced media file has an extension that does not map to a supported outbound media type (image/video/audio). The path is resolved against the outbound root first, then its type is classified via _outbound_media_type.","triggerScenarios":"Passing a ChannelMediaRef whose file is e.g. .txt, .pdf, .docx, or has no recognizable extension to outbound_channel_media (via _outbound_media_from_refs).","commonSituations":"Attaching generated artifacts (logs, spreadsheets) to a chat message; a file saved without an extension; an extension the library does not whitelist.","solutions":["Send only files with supported media extensions (images/videos/audio per _outbound_media_type)","Convert or rename the file to a supported format/type before sending","If the type should be supported, check the whitelist in media.py for the expected extension"],"exampleFix":"// before\nChannelMediaRef(path=Path(\"report.pdf\"))\n// after\nChannelMediaRef(path=Path(\"chart.png\"))  # convert the pdf chart to a supported image","handlingStrategy":"validation","validationCode":"SUPPORTED = {\".png\", \".jpg\", \".jpeg\", \".gif\", \".webp\", \".mp4\", \".webm\", \".mp3\", \".ogg\", \".wav\"}\nif path.suffix.lower() not in SUPPORTED:\n    raise ValueError(f\"unsupported media type: {path.suffix}\")","typeGuard":"def is_supported_media(path: Path) -> bool:\n    from deepagents_talon.media import _outbound_media_type\n    return _outbound_media_type(path) is not None","tryCatchPattern":"try:\n    media = outbound_channel_media(ref)\nexcept ValueError as exc:\n    logger.warning(\"Skipping attachment: %s\", exc)\n    media = None","preventionTips":["Whitelist extensions before attaching files to messages","Convert documents to supported images/media before sending","Keep file extensions intact when writing generated media"],"tags":["media","validation","filetype"],"backgroundTag":"unsupported-media-type","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}