{"record":{"id":"85cde0f59397ffa1","repo":"tonhowtf/omniget","slug":"invalidrequest","errorCode":"InvalidRequest","errorMessage":"Unsupported link","messagePattern":"Unsupported link","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/bluesky/mod.rs","lineNumber":147,"sourceCode":"        let uri = format!(\"at://{}/app.bsky.feed.post/{}\", user, post_id);\n        let url = format!(\n            \"{}?depth=0&parentHeight=0&uri={}\",\n            API_BASE,\n            urlencoding::encode(&uri)\n        );\n\n        let response = self.client.get(&url).send().await?;\n\n        if !response.status().is_success() {\n            return Err(anyhow!(\"Bluesky API retornou HTTP {}\", response.status()));\n        }\n\n        let json: serde_json::Value = response.json().await?;\n\n        if let Some(error) = json.get(\"error\").and_then(|e| e.as_str()) {\n            return match error {\n                \"NotFound\" | \"InternalServerError\" => Err(anyhow!(\"Post not available\")),\n                \"InvalidRequest\" => Err(anyhow!(\"Unsupported link\")),\n                _ => Err(anyhow!(\"Erro da API: {}\", error)),\n            };\n        }\n\n        Ok(json)\n    }\n}\n\nenum BlueskyMedia {\n    Video { hls_url: String },\n    Images { urls: Vec<String> },\n    Gif { url: String },\n}\n\nfn extract_media(embed: &serde_json::Value) -> Option<BlueskyMedia> {\n    let embed_type = embed.get(\"$type\")?.as_str()?;\n\n    match embed_type {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/bluesky/mod.rs#L129-L165","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Validate the handle and rkey formats (DID/handle pattern, 13-char k-sorted rkey) before issuing the request.","Normalize the input URL to the canonical bsky.app form before extraction.","Ask the user for a fresh, direct post link from the official app or bsky.app.","Log the constructed at-uri alongside the error to diagnose which part was rejected."],"exampleFix":"// before\n\"InvalidRequest\" => Err(anyhow!(\"Unsupported link\")),\n// after\n\"InvalidRequest\" => Err(anyhow!(\"Unsupported link (at-uri: {})\", uri)),","handlingStrategy":"validation","validationCode":"fn valid_bsky_post_url(url: &str) -> bool {\n    let re = regex::Regex::new(r\"^https://bsky\\.app/profile/[^/]+/post/[A-Za-z0-9]+$\").unwrap();\n    re.is_match(url.split('?').next().unwrap_or(url))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regex-validate the post URL before extraction and request.","Normalize custom-gateway URLs to canonical bsky.app form.","Log the constructed at-uri when InvalidRequest occurs."],"tags":["rust","bluesky","invalid-request","url-parsing"],"backgroundTag":"invalid-request","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"}