tonhowtf/omniget · error

não reconheci esse canal

Error message

não reconheci esse canal: {}

What it means

run() in the emotes tool parses the channel argument through parse_channel, which extracts a login from a channel URL or plain login. It throws when the given string cannot be recognized as either. The error message includes the raw unrecognized value.

Solutions

  1. Pass the plain login (lowercase, e.g. 'xqc') or a direct channel URL like https://www.twitch.tv/xqc
  2. Trim slashes, query strings, and extra path segments from the channel value
  3. Check the parse_channel implementation for the accepted formats and match one
  4. Leave opts.channel empty if you want global emotes instead of a specific channel

Example fix

// before
let opts = EmoteOpts { channel: "https://www.twitch.tv/xqc/about".into(), .. };
// after
let opts = EmoteOpts { channel: "https://www.twitch.tv/xqc".into(), .. };
Defensive patterns

Strategy: validation

Validate before calling

fn is_recognizable_channel(s: &str) -> bool {
    let t = s.trim().trim_end_matches('/');
    t.is_empty()
        || t.parse::<u64>().is_err() // not a numeric user id
            && t.split('/').last().map_or(false, |l| {
                !l.is_empty() && l.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')
            })
}

Try / catch

let opts = EmoteOpts { channel: input.clone(), .. };
if !is_recognizable_channel(&input) {
    eprintln!("'{input}' is not a login or channel URL");
    return Ok(());
}
match run(opts).await {
    Err(e) if e.to_string().contains("não reconheci") => {
        eprintln!("Unrecognized channel: {input}. Pass a plain login or https://twitch.tv/<login>");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Passing opts.channel with an unexpected format to the emotes download tool (via live_baixa_um_conjunto_pequeno): e.g. a display name with spaces, a URL variant parse_channel does not handle, a full URL with extra path segments, or an empty-after-trim string handled differently.

Common situations: Pasting a channel display name instead of the login (e.g. capitalization is fine, but special characters break it); pasting an /about or /videos deep link; pasting the channel's internal numeric id; typos or trailing whitespace/slashes in scripts.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/twitch/emotes.rs:537

async fn json_get(http: &reqwest::Client, url: &str) -> anyhow::Result<Value> {
    let resp = http.get(url).send().await?;
    if !resp.status().is_success() {
        anyhow::bail!("{} respondeu HTTP {}", url, resp.status());
    }
    Ok(resp.json::<Value>().await?)
}

pub async fn run(opts: &Options, p: &ProgressFn) -> anyhow::Result<Result> {
    let gql = Gql::new()?;
    let http = super::super::client()?;

    let login = if opts.channel.trim().is_empty() {
        None
    } else {
        Some(
            super::gql::parse_channel(&opts.channel)
                .ok_or_else(|| anyhow!("não reconheci esse canal: {}", opts.channel))?,
        )
    };

    report(p, ID, "progress", 0, None, Some("lendo o canal".into()));
    let channel = match &login {
        Some(l) => Some(gql.channel(l).await?),
        None => None,
    };
    let channel_id = channel.as_ref().map(|c| c.id.clone()).unwrap_or_default();
    let label = channel
        .as_ref()
        .map(|c| c.login.clone())
        .unwrap_or_else(|| "global".to_string());

    let mut items: Vec<Emote> = Vec::new();

    if opts.twitch {
        if let Some(l) = &login {

View on GitHub (pinned to 8600b91f42)