{"record":{"id":"244bd70b611db9d8","repo":"zeroclaw-labs/zeroclaw","slug":"telegram-sendvideo-failed-err","errorCode":null,"errorMessage":"Telegram sendVideo failed: {err}","messagePattern":"Telegram sendVideo failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-channels/src/telegram.rs","lineNumber":3364,"sourceCode":"\n        if let Some(tid) = thread_id {\n            form = form.text(\"message_thread_id\", tid.to_string());\n        }\n\n        if let Some(cap) = caption {\n            form = form.text(\"caption\", cap.to_string());\n        }\n\n        let resp = self\n            .http_client()\n            .post(self.api_url(\"sendVideo\"))\n            .multipart(form)\n            .send()\n            .await?;\n\n        if !resp.status().is_success() {\n            let err = resp.text().await?;\n            anyhow::bail!(\"Telegram sendVideo failed: {err}\");\n        }\n\n        ::zeroclaw_log::record!(\n            INFO,\n            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)\n                .with_attrs(::serde_json::json!({\"chat_id\": chat_id, \"file_name\": file_name})),\n            \"video sent to\"\n        );\n        Ok(())\n    }\n\n    /// Send an audio file to a Telegram chat\n    pub async fn send_audio(\n        &self,\n        chat_id: &str,\n        thread_id: Option<&str>,\n        file_path: &Path,\n        caption: Option<&str>,","sourceCodeStart":3346,"sourceCodeEnd":3382,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-channels/src/telegram.rs#L3346-L3382","documentation":"send_video() uploads a video file as multipart sendVideo and bails with Telegram's response body on non-2xx. Videos have the strictest limits and encoding expectations of the media methods, so most rejections are size, codec, or chat-permission related.","triggerScenarios":"413 when the video exceeds the 50MB bot-upload cap; 400 when the container/codec is not streamable H.264/MPEG4 Telegram accepts; 400 'chat not found' or a thread_id that is not a forum topic; 403 blocked/kicked; 429 flood control.","commonSituations":"Screen recordings over 50MB; HEVC/odd-container exports from generation tools; sending into a chat the bot was removed from while a queued reply flushed.","solutions":["Read the embedded `description` for the exact reason.","Check size against 50MB and re-encode (ffmpeg -c:v libx264 -movflags +faststart) when Telegram rejects the container.","Verify chat_id/thread_id and stop sending on 403 blocked/kicked.","Honor retry_after on 429 and resend once."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const VIDEO_LIMIT: u64 = 50 * 1024 * 1024;\nlet meta = tokio::fs::metadata(file_path).await?;\nanyhow::ensure!(meta.len() <= VIDEO_LIMIT, \"video {}MB exceeds 50MB\", meta.len() / 1024 / 1024);","typeGuard":"fn is_video_rejected_for_size(err: &anyhow::Error) -> bool {\n    let s = err.to_string();\n    s.contains(\"413\") || s.contains(\"file is too big\")\n}","tryCatchPattern":"if let Err(e) = channel.send_video(chat, thread, path, caption).await {\n    if is_video_rejected_for_size(&e) {\n        return channel.send_document(chat, thread, path, caption).await; // preserve as file\n    }\n    return Err(e);\n}","preventionTips":["Re-encode to H.264 with -movflags +faststart for reliable Telegram playback.","Check 50MB cap before upload; fall back to document send for larger files.","Verify thread_id is a real forum topic when targeting one."],"tags":["telegram","sendvideo","multipart","upload","video"],"backgroundTag":"telegram-file-upload-failed","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}