{"record":{"id":"8244e8748d345a1a","repo":"tonhowtf/omniget","slug":"vimeo-code","errorCode":"vimeo:{code}","errorMessage":"vimeo:{code}","messagePattern":"vimeo:(.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/vimeo.rs","lineNumber":761,"sourceCode":"/// Roda o yt-dlp e devolve o stdout inteiro. Usado só pela enumeração.\nasync fn run_json(bin: &Path, args: &[String], secrets: &[&str]) -> Result<String> {\n    let _slot = crate::core::ytdlp::acquire_ytdlp_slot(\"vimeo-list\").await;\n    let mut cmd = crate::core::ytdlp::ytdlp_command(bin);\n    cmd.args(args).stdin(std::process::Stdio::null());\n    let out = cmd\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"não foi possível iniciar o yt-dlp: {e}\"))?;\n    if !out.status.success() {\n        let tail = scrub(&String::from_utf8_lossy(&out.stderr), secrets);\n        let msg = tail\n            .lines()\n            .rev()\n            .find(|l| !l.trim().is_empty())\n            .unwrap_or(\"\")\n            .to_string();\n        return Err(match error_code(&msg) {\n            Some(code) => anyhow!(\"vimeo:{code}\"),\n            None => anyhow!(\"{}\", msg),\n        });\n    }\n    Ok(String::from_utf8_lossy(&out.stdout).to_string())\n}\n\n/// O que sobrou de um download. `tail` já passou pelo `scrub`.\nstruct DownloadOutcome {\n    file: Option<String>,\n    meta: Option<(String, String)>,\n    tail: String,\n    success: bool,\n}\n\n/// Roda um download e conta o que aconteceu.\nasync fn run_download(\n    bin: &Path,\n    args: &[String],","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/vimeo.rs#L743-L779","documentation":"Compact error form thrown by run_json when yt-dlp exits non-zero and its stderr tail matches a known error_code pattern (vimeo.rs:761). Instead of leaking the full stderr, the library normalizes it to `vimeo:<code>` (e.g., login-required, private video, geo-restriction) so callers can match programmatically. Secrets are scrubbed from the message before classification.","triggerScenarios":"Any Vimeo enumeration via run_json where yt-dlp fails with a recognized condition: video is private or members-only, login/cookies required, geo-blocked, removed, or rate-limited — error_code() matches the stderr tail.","commonSituations":"Attempting to list a private showcase without cookies; Vimeo DRM/member-only content; region-locked videos; Vimeo throttling an IP after heavy enumeration.","solutions":["Parse the code after the `vimeo:` prefix and map it to a user-facing message (private, geo-blocked, etc.).","For login-required codes, supply cookies/credentials (`--cookies-from-browser` or the app's auth option).","For geo/removed content, there is no retry fix — inform the user the video is unavailable.","For rate-limit codes, back off and retry later with reduced concurrency (acquire_ytdlp_slot already throttles)."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"fn vimeo_code(err: &anyhow::Error) -> Option<&str> {\n    let s = err.to_string();\n    s.strip_prefix(\"vimeo:\").map(|c| c.trim())\n}","typeGuard":"fn is_vimeo_coded_error(msg: &str) -> Option<&str> {\n    msg.strip_prefix(\"vimeo:\").filter(|c| !c.is_empty())\n}","tryCatchPattern":"match one(url).await {\n    Err(e) => match is_vimeo_coded_error(&e.to_string()) {\n        Some(\"login-required\" | \"private\") => eprintln!(\"vídeo privado: forneça cookies de autenticação\"),\n        Some(\"geo-restricted\") => eprintln!(\"vídeo indisponível na sua região\"),\n        Some(code) => eprintln!(\"vimeo falhou: {code}\"),\n        None => return Err(e),\n    },\n    ok => ok,\n}","preventionTips":["Match on the vimeo:<code> prefix instead of free text — it is the stable contract","Keep yt-dlp updated so recognized error classifications stay accurate","Provide cookie/auth options up front for private or members-only Vimeo content","Apply backoff on rate-limit codes before retrying enumeration"],"tags":["yt-dlp","vimeo","error-classification","external-process"],"backgroundTag":"api-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}