{"record":{"id":"be8a263118239f13","repo":"tonhowtf/omniget","slug":"canal-n-o-encontrado","errorCode":null,"errorMessage":"canal não encontrado: {}","messagePattern":"canal não encontrado: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/twitch/gql.rs","lineNumber":206,"sourceCode":"            \"operationName\": op,\n            \"variables\": vars,\n            \"extensions\": { \"persistedQuery\": { \"version\": 1, \"sha256Hash\": hash } },\n        }]);\n        let json = self.post(&body).await?;\n        json.as_array()\n            .and_then(|a| a.first())\n            .cloned()\n            .ok_or_else(|| anyhow!(\"resposta em lote inesperada do Twitch GQL\"))\n    }\n\n    pub async fn channel(&self, login: &str) -> anyhow::Result<Channel> {\n        let q = format!(\n            r#\"{{ user(login: \"{}\") {{ id login displayName profileImageURL(width: 300) }} }}\"#,\n            escape(login)\n        );\n        let data = self.query(&q).await?;\n        let u = data.get(\"user\").filter(|v| !v.is_null());\n        let u = u.ok_or_else(|| anyhow!(\"canal não encontrado: {}\", login))?;\n        Ok(Channel {\n            id: str_at(u, \"id\"),\n            login: str_at(u, \"login\"),\n            display_name: str_at(u, \"displayName\"),\n            avatar: str_at(u, \"profileImageURL\"),\n        })\n    }\n\n    pub async fn video(&self, id: &str) -> anyhow::Result<VideoInfo> {\n        let q = format!(\n            r#\"{{ video(id: \"{}\") {{ id title lengthSeconds createdAt owner {{ login displayName }} }} }}\"#,\n            escape(id)\n        );\n        let data = self.query(&q).await?;\n        let v = data.get(\"video\").filter(|v| !v.is_null());\n        let v = v.ok_or_else(|| anyhow!(\"VOD não encontrado (ou já expirou): {}\", id))?;\n        Ok(VideoInfo {\n            id: str_at(v, \"id\"),","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/twitch/gql.rs#L188-L224","documentation":"channel() runs a GraphQL lookup by login and throws when the response's data.user is absent or null, i.e. no Twitch user with that login exists (or the lookup was filtered). The login is echoed in the message for debugging.","triggerScenarios":"Calling gql.channel(login) with a login that does not exist on Twitch, was renamed, is a banned/deleted account, or with a display name / URL rather than the actual login in edge cases where Twitch returns user:null.","commonSituations":"Typos in the channel name; channels suspended or renamed; using a historical login after a rename; passing a numeric user id where a login is expected; sub-only scenarios don't apply but deleted accounts do.","solutions":["Verify the login exists on twitch.tv/<login>","Use the current login if the channel was renamed","Check for typos, trailing slashes or whitespace in the login","Handle the error as 'channel not found' and prompt the user for a corrected name"],"exampleFix":"// before\nlet ch = gql.channel(\"xqcoww\").await?;\n// after\nlet ch = match gql.channel(\"xqc\").await {\n    Ok(c) => c,\n    Err(e) if e.to_string().contains(\"não encontrado\") => {\n        eprintln!(\"channel not found, check the login\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n};","handlingStrategy":"validation","validationCode":"let login = input.trim().trim_start_matches(\"https://www.twitch.tv/\").trim_matches('/');\nif login.is_empty()\n    || !login.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')\n    || login.parse::<u64>().is_ok()\n{\n    eprintln!(\"'{input}' is not a valid Twitch login\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match gql.channel(login).await {\n    Err(e) if e.to_string().contains(\"não encontrado\") => {\n        eprintln!(\"Channel '{login}' not found on Twitch\");\n        Ok(())\n    }\n    other => other,\n}","preventionTips":["Confirm the channel exists at twitch.tv/<login> first","Use the current login after channel renames","Strip URLs down to the login segment; never pass numeric ids","Trim whitespace and control characters from user input"],"tags":["twitch","gql","channel","not-found"],"backgroundTag":"entity-not-found","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"}