tonhowtf/omniget · error

canal não encontrado

Error message

canal não encontrado: {}

What it means

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.

Solutions

  1. Verify the login exists on twitch.tv/<login>
  2. Use the current login if the channel was renamed
  3. Check for typos, trailing slashes or whitespace in the login
  4. Handle the error as 'channel not found' and prompt the user for a corrected name

Example fix

// before
let ch = gql.channel("xqcoww").await?;
// after
let ch = match gql.channel("xqc").await {
    Ok(c) => c,
    Err(e) if e.to_string().contains("não encontrado") => {
        eprintln!("channel not found, check the login");
        return Err(e);
    }
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: validation

Validate before calling

let login = input.trim().trim_start_matches("https://www.twitch.tv/").trim_matches('/');
if login.is_empty()
    || !login.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')
    || login.parse::<u64>().is_ok()
{
    eprintln!("'{input}' is not a valid Twitch login");
    return Ok(());
}

Try / catch

match gql.channel(login).await {
    Err(e) if e.to_string().contains("não encontrado") => {
        eprintln!("Channel '{login}' not found on Twitch");
        Ok(())
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/twitch/gql.rs:206

            "operationName": op,
            "variables": vars,
            "extensions": { "persistedQuery": { "version": 1, "sha256Hash": hash } },
        }]);
        let json = self.post(&body).await?;
        json.as_array()
            .and_then(|a| a.first())
            .cloned()
            .ok_or_else(|| anyhow!("resposta em lote inesperada do Twitch GQL"))
    }

    pub async fn channel(&self, login: &str) -> anyhow::Result<Channel> {
        let q = format!(
            r#"{{ user(login: "{}") {{ id login displayName profileImageURL(width: 300) }} }}"#,
            escape(login)
        );
        let data = self.query(&q).await?;
        let u = data.get("user").filter(|v| !v.is_null());
        let u = u.ok_or_else(|| anyhow!("canal não encontrado: {}", login))?;
        Ok(Channel {
            id: str_at(u, "id"),
            login: str_at(u, "login"),
            display_name: str_at(u, "displayName"),
            avatar: str_at(u, "profileImageURL"),
        })
    }

    pub async fn video(&self, id: &str) -> anyhow::Result<VideoInfo> {
        let q = format!(
            r#"{{ video(id: "{}") {{ id title lengthSeconds createdAt owner {{ login displayName }} }} }}"#,
            escape(id)
        );
        let data = self.query(&q).await?;
        let v = data.get("video").filter(|v| !v.is_null());
        let v = v.ok_or_else(|| anyhow!("VOD não encontrado (ou já expirou): {}", id))?;
        Ok(VideoInfo {
            id: str_at(v, "id"),

View on GitHub (pinned to 8600b91f42)