tonhowtf/omniget · error
No URL found in MediaInfo
Error message
No URL found in MediaInfo
What it means
This error is thrown by the P2P download routine when the MediaInfo passed in has no entries in its available_qualities list, so there is no URL to download from. The library requires at least one quality entry whose .url field supplies the P2P transfer target (expected to look like 'p2p:<code>'). It is a guard against being asked to download from an empty/unresolved MediaInfo.
Solutions
- Inspect the MediaInfo before calling download() and ensure available_qualities contains at least one entry with a valid 'p2p:' URL
- Re-run the resolution step (resolve/get MediaInfo) that should populate available_qualities and surface its errors instead of swallowing them
- Fix upstream code that constructs MediaInfo so it always appends the P2P quality URL
Example fix
// before
let info = MediaInfo { ..Default::default() }; // empty available_qualities
p2p::download(&info, &opts, tx).await?;
// after
let info = p2p::resolve(&code).await?; // populates available_qualities
if info.available_qualities.is_empty() {
anyhow::bail!("P2P code resolved to no downloadable qualities");
}
p2p::download(&info, &opts, tx).await?; Defensive patterns
Strategy: validation
Validate before calling
let url = info.available_qualities.first().map(|q| q.url.clone()).filter(|u| u.starts_with("p2p:"));
if url.is_none() {
anyhow::bail!("MediaInfo has no P2P quality URL; re-resolve the source first");
} Type guard
fn has_p2p_url(info: &MediaInfo) -> bool {
info.available_qualities.first().map_or(false, |q| q.url.starts_with("p2p:"))
} Prevention
- Never hand-construct MediaInfo for downloads; always use the resolver API
- Assert non-empty available_qualities in tests that exercise download()
- Log the MediaInfo contents when download fails to spot empty resolution early
When it happens
Trigger: Calling download() with a MediaInfo whose available_qualities vec is empty — typically because resolution of the P2P code produced no qualities, or a caller constructed MediaInfo manually without filling available_qualities.
Common situations: A platform resolver returned early/failed silently and produced an empty MediaInfo; a hand-built MediaInfo in tests or glue code; a parse of a share code that yielded no candidate URLs.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Download cancelled
- Download cancelled
- Track sem metadata pra resolver no YouTube
- download falhou: HTTP {}
- download de {} falhou: HTTP {}
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/ed217929c3496c50.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/p2p.rs:110
width: 0,
height: 0,
url: url.to_string(),
format: "p2p".to_string(),
}],
media_type: MediaType::Video,
file_size_bytes: None,
})
}
async fn download(
&self,
info: &MediaInfo,
opts: &DownloadOptions,
progress: mpsc::Sender<ProgressUpdate>,
) -> anyhow::Result<DownloadResult> {
let url = match info.available_qualities.first() {
Some(q) => &q.url,
None => anyhow::bail!("No URL found in MediaInfo"),
};
let code = url
.strip_prefix("p2p:")
.ok_or_else(|| anyhow!("Invalid P2P URL"))?;
let _ = progress.send(ProgressUpdate::percent(-2.0)).await;
tracing::info!("[p2p] connecting to relay for code: {}", code);
let stream = connect_relay().await?;
let (read_half, mut write_half) = tokio::io::split(stream);
let mut reader = BufReader::new(read_half);
write_half
.write_all(format!("RECV {}\n", code).as_bytes())
.await?;
write_half.flush().await?;View on GitHub (pinned to 8600b91f42)