tonhowtf/omniget · error
Clip not found
Error message
Clip not found: {} What it means
Raised by fetch_clip_metadata when the successful GQL response JSON has no /data/clip key at all (json.pointer returns None). This indicates the response structure itself lacks the clip object — usually a GraphQL-level error response (errors array, data null) rather than a normal result.
Solutions
- Inspect the response body for an errors array and surface the GQL error message
- Fall back to yt-dlp extraction for this URL
- Update the GraphQL query to match the current Twitch schema
Example fix
// before
let clip = json.pointer("/data/clip").ok_or_else(|| anyhow!("Clip not found: {}", slug))?;
// after
let clip = json.pointer("/data/clip").ok_or_else(|| {
let gql_err = json.pointer("/errors/0/message").and_then(|v| v.as_str()).unwrap_or("no data.clip in response");
anyhow!("Clip lookup failed for {}: {}", slug, gql_err)
})?; Defensive patterns
Strategy: try-catch
Validate before calling
// Detect a GQL error envelope before treating the response as a clip result:
let is_gql_error = body.contains("\"errors\"") && body.contains("\"data\":null"); Try / catch
match downloader.get_media_info(url).await {
Err(e) if e.to_string().contains("Clip not found") && !e.to_string().contains("is null") => {
log::warn!("GQL envelope lacked data.clip — likely schema/persisted-query change");
fallback_ytdlp_info(url).await
}
other => other,
} Prevention
- Log the raw GQL body when data.clip is absent to distinguish errors from genuine miss
- Keep the GraphQL query aligned with the live Twitch schema
- Route envelope-shaped failures to yt-dlp instead of failing outright
When it happens
Trigger: GQL returns HTTP 200 but body is {"data":null,"errors":[...]} or an entirely different envelope (e.g. persisted-query rejection), so /data/clip does not exist.
Common situations: Twitch persisted-query or schema change invalidating the inline query; GQL returning a structured errors array for an unknown slug; proxies returning HTML error pages that fail earlier at json parse.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- Access token not available for clip
- Track sem soundcloud_id
- SoundCloud nao retornou URL
- Spotify SDK device not ready
- Track sem metadata pra resolver no YouTube
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/ae127109a2967001.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/twitch.rs:146
let body = serde_json::json!({ "query": query });
let response = self
.client
.post(GQL_URL)
.header("client-id", CLIENT_ID)
.json(&body)
.send()
.await?;
if !response.status().is_success() {
return Err(anyhow!("Twitch GQL retornou HTTP {}", response.status()));
}
let json: serde_json::Value = response.json().await?;
let clip = json
.pointer("/data/clip")
.ok_or_else(|| anyhow!("Clip not found: {}", slug))?;
if clip.is_null() {
return Err(anyhow!("Clip not found: {}", slug));
}
let title = clip
.get("title")
.and_then(|v| v.as_str())
.unwrap_or("Untitled")
.to_string();
let duration_seconds = clip
.get("durationSeconds")
.and_then(|v| v.as_f64())
.unwrap_or(0.0);
let thumbnail_url = clip
.get("medium")View on GitHub (pinned to 8600b91f42)