{"record":{"id":"def3a32f36b5a6d0","repo":"langchain-ai/deepagents","slug":"unsupported-media-mime-type-mime","errorCode":null,"errorMessage":"unsupported media mime type: {mime}","messagePattern":"unsupported media mime type: (.+?)","errorType":"exception","errorClass":"ChannelMediaError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/channels/base.py","lineNumber":492,"sourceCode":"    window = text[:limit]\n    for delimiter in (\"\\n\\n\", \"\\n\", \" \"):\n        index = window.rfind(delimiter)\n        if index > 0:\n            return index + len(delimiter)\n    return limit\n\n\ndef _media_type(path: Path) -> str:\n    mime, _ = mimetypes.guess_type(path)\n    if mime is None:\n        msg = f\"unsupported media file type: {path}\"\n        raise ChannelMediaError(msg)\n    if mime.startswith(\"image/\"):\n        return \"image\"\n    if mime.startswith(\"video/\"):\n        return \"video\"\n    msg = f\"unsupported media mime type: {mime}\"\n    raise ChannelMediaError(msg)\n\n\n_RETRYABLE_ERROR_FRAGMENTS = frozenset(\n    {\n        \"connectionerror\",\n        \"connectionreset\",\n        \"connectionrefused\",\n        \"connecttimeout\",\n        \"timeout\",\n        \"broken pipe\",\n        \"remotedisconnected\",\n        \"eoferror\",\n        \"network\",\n        \"transient\",\n    }\n)\n\n","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/channels/base.py#L474-L510","documentation":"`_media_type` only accepts files whose guessed MIME type starts with `image/` or `video/`. Any other recognized MIME type (audio, documents, archives, etc.) is rejected with `ChannelMediaError` so channels never forward non-image/non-video attachments to the agent.","triggerScenarios":"Calling `validate_media` on a file with a known but unsupported MIME type, e.g. `.mp3` (audio/mpeg), `.pdf` (application/pdf), `.zip`, or `.txt`.","commonSituations":"Users send voice notes, documents, or compressed archives over Telegram and the pipeline tries to attach them; automation forwards arbitrary files into the channel media directory.","solutions":["Send only image or video files; convert other content to an image/video if needed.","Filter attachments by MIME type before calling `validate_media` and skip or flag unsupported types.","If document support is required, request/extend the channel's media handling rather than bypassing validation."],"exampleFix":"# before\nvalidate_media(Path('voice_note.ogg'))  # audio/ogg -> ChannelMediaError\n# after\nif (mime := mimetypes.guess_type('voice_note.ogg')[0]) and mime.startswith(('image/', 'video/')):\n    validate_media(Path('voice_note.ogg'))","handlingStrategy":"validation","validationCode":"import mimetypes\nfrom pathlib import Path\ndef is_image_or_video(path: Path) -> bool:\n    mime, _ = mimetypes.guess_type(path)\n    return bool(mime) and (mime.startswith(\"image/\") or mime.startswith(\"video/\"))\n\nif not is_image_or_video(attachment):\n    skip(attachment)","typeGuard":"def is_supported_mime(mime: str | None) -> bool:\n    return mime is not None and mime.startswith((\"image/\", \"video/\"))","tryCatchPattern":"try:\n    validate_media(path)\nexcept ChannelMediaError as exc:\n    notify_sender(f\"Attachment not supported (images/videos only): {exc}\")","preventionTips":["Filter non-image/non-video MIME types at the ingestion boundary","Convert common formats (e.g. audio) or explicitly reject them with a user message","Document supported media types for channel users","Centralize the accepted-MIME list in one place to keep it consistent"],"tags":["media","validation","channels"],"backgroundTag":"unsupported-media-type","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}