tonhowtf/omniget · error · anyhow::Error

InvalidRequest

InvalidRequest

Error message

Unsupported link

What it means

In `fetch_post` (src-tauri/src/platforms/bluesky/mod.rs:147), the AppView returned `error: "InvalidRequest"`, which the code maps to "Unsupported link". The request itself was malformed from Bluesky's perspective — typically an invalid at-uri, handle, or record key.

Solutions

  1. Validate the handle and rkey formats (DID/handle pattern, 13-char k-sorted rkey) before issuing the request.
  2. Normalize the input URL to the canonical bsky.app form before extraction.
  3. Ask the user for a fresh, direct post link from the official app or bsky.app.
  4. Log the constructed at-uri alongside the error to diagnose which part was rejected.

Example fix

// before
"InvalidRequest" => Err(anyhow!("Unsupported link")),
// after
"InvalidRequest" => Err(anyhow!("Unsupported link (at-uri: {})", uri)),
Defensive patterns

Strategy: validation

Validate before calling

fn valid_bsky_post_url(url: &str) -> bool {
    let re = regex::Regex::new(r"^https://bsky\.app/profile/[^/]+/post/[A-Za-z0-9]+$").unwrap();
    re.is_match(url.split('?').next().unwrap_or(url))
}

Prevention

When it happens

Trigger: The extracted handle or post id is not a valid identifier (bad characters, wrong length rkey), or the URL parsed to a non-post path that produced a syntactically invalid at-uri sent to getPostThread.

Common situations: URLs from custom gateways or mirrors with altered path shapes; handles with unusual casing or trailing slashes; post ids that aren't valid rkeys (e.g. numeric legacy ids).

Related errors


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

Appendix: source

Thrown at src-tauri/src/platforms/bluesky/mod.rs:147

        let uri = format!("at://{}/app.bsky.feed.post/{}", user, post_id);
        let url = format!(
            "{}?depth=0&parentHeight=0&uri={}",
            API_BASE,
            urlencoding::encode(&uri)
        );

        let response = self.client.get(&url).send().await?;

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

        let json: serde_json::Value = response.json().await?;

        if let Some(error) = json.get("error").and_then(|e| e.as_str()) {
            return match error {
                "NotFound" | "InternalServerError" => Err(anyhow!("Post not available")),
                "InvalidRequest" => Err(anyhow!("Unsupported link")),
                _ => Err(anyhow!("Erro da API: {}", error)),
            };
        }

        Ok(json)
    }
}

enum BlueskyMedia {
    Video { hls_url: String },
    Images { urls: Vec<String> },
    Gif { url: String },
}

fn extract_media(embed: &serde_json::Value) -> Option<BlueskyMedia> {
    let embed_type = embed.get("$type")?.as_str()?;

    match embed_type {

View on GitHub (pinned to 8600b91f42)