tonhowtf/omniget · error · anyhow::Error

Syndication API retornou HTTP

Error message

Syndication API retornou HTTP {}

What it means

request_syndication raises this error when the CDN syndication endpoint (cdn.syndication.twimg.com/tweet-result) returns any non-2xx status. The syndication API is a token-protected fallback path, so a bad status there means the fallback lookup itself failed.

Solutions

  1. Log the status and verify the syndication token computation is still valid (403 usually means the token scheme changed)
  2. Treat 404 as 'post unavailable' and fall back to the GraphQL path or vice versa
  3. Retry 5xx with exponential backoff; syndication outages are usually transient
  4. Update the app if Twitter changed the syndication endpoint requirements

Example fix

// before
if !response.status().is_success() {
    return Err(anyhow!("Syndication API retornou HTTP {}", response.status()));
}
// after
if !response.status().is_success() {
    return Err(anyhow!("Syndication API retornou HTTP {} body={}", response.status(),
        response.text().await.unwrap_or_default()));
}
Defensive patterns

Strategy: fallback

Validate before calling

fn is_plausible_tweet_id(id: &str) -> bool {
    !id.is_empty() && id.chars().all(|c| c.is_ascii_digit())
}

Try / catch

match request_syndication(id, &token).await {
    Err(e) if e.to_string().starts_with("Syndication API retornou HTTP 5") => {
        request_tweet(id).await // GraphQL fallback
    }
    Err(e) if e.to_string().contains("403") => {
        let tok = recompute_syndication_token(id);
        request_syndication(id, &tok).await
    }
    other => other,
}

Prevention

When it happens

Trigger: GET to the syndication tweet-result endpoint returns 404 (tweet unavailable via syndication), 403 (syndication token invalid/rejected), or 5xx (CDN/server error).

Common situations: calculate_syndication_token algorithm outdated after Twitter changes (403); tweet deleted/age-restricted so syndication returns 404; syndication CDN outage (5xx); rate limiting of the shared syndication endpoint.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/f2cc22ed13f6276d. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/twitter/mod.rs:460

            "https://cdn.syndication.twimg.com/tweet-result?id={}&token={}",
            tweet_id, token
        );

        let mut request = self.client.get(&url);
        if let Some(cookie) = Self::auth_cookie_string() {
            request = request.header("Cookie", cookie);
        }

        let response = request.send().await?;
        tracing::debug!(
            "[twitter] syndication tweet_id={} token={} status={}",
            tweet_id,
            token,
            response.status()
        );

        if !response.status().is_success() {
            return Err(anyhow!(
                "Syndication API retornou HTTP {}",
                response.status()
            ));
        }

        response.json().await.map_err(Into::into)
    }

    fn extract_graphql_media(
        json: &serde_json::Value,
        tweet_id: &str,
    ) -> anyhow::Result<Vec<serde_json::Value>> {
        let instructions = json
            .pointer("/data/threaded_conversation_with_injections_v2/instructions")
            .and_then(|v| v.as_array())
            .ok_or_else(|| anyhow!("Post not available"))?;

        let add_insn = instructions

View on GitHub (pinned to 8600b91f42)