tonhowtf/omniget · warning

cole o link de um post do Reddit (ou o id dele)

Error message

cole o link de um post do Reddit (ou o id dele)

What it means

`resolve_post` first normalizes the user-supplied string via `parse_target`; if the input is neither a recognizable Reddit post URL nor a bare post id, this error is thrown before any network request. It is the input-validation guard for the thread archiving entry point.

Solutions

  1. Paste the full post permalink (e.g. https://reddit.com/r/sub/comments/<id>/...) or just the 6-7 character post id
  2. Strip whitespace/markdown around the link before passing it
  3. For share links (reddit.com/s/...), pass them as-is — they are resolved via fetcher.resolve, but the final URL must still be a post
  4. If handling user input programmatically, pre-validate with super::parse_target and show a clearer prompt on None

Example fix

// before
let (id, _) = resolve_post(&fetcher, user_input).await?;
// after
if super::parse_target(user_input).is_none() {
    anyhow::bail!("entrada inválida: '{}' não é um link de post nem um id", user_input.trim());
}
let (id, _) = resolve_post(&fetcher, user_input).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn is_probable_post_input(s: &str) -> bool {
    let s = s.trim();
    // bare id (6-8 alnum chars) or a /comments/ permalink
    (s.len() >= 5 && s.len() <= 8 && s.chars().all(|c| c.is_ascii_alphanumeric()))
        || s.contains("/comments/")
}

Try / catch

match resolve_post(&fetcher, input).await {
    Ok((id, title)) => /* ... */,
    Err(e) if e.to_string().contains("cole o link") => {
        eprintln!("entrada '{}' não é um post: use o permalink /r/sub/comments/<id>/... ou o id", input);
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling run (which calls resolve_post) with an empty string, a comment/permalink/user/subreddit URL, a URL from another site, or any string that super::parse_target cannot classify as a post target — at src-tauri/omniget-core/src/core/tools/reddit/thread.rs:800.

Common situations: Users pasting a comment permalink instead of the post URL, pasting a subreddit or user link, typos/extra text around the URL, pasting a share link (resolved separately as Target::Short), or passing a bare id with surrounding whitespace/punctuation.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/thread.rs:800

#[derive(Debug, Clone, Serialize)]
pub struct ThreadResult {
    pub title: String,
    pub subreddit: String,
    pub author: String,
    pub permalink: String,
    pub comments: usize,
    pub missing: usize,
    pub requests: u32,
    pub files: Vec<String>,
    pub dest: String,
    /// Se o arquivamento saiu com a sessão do usuário ou anônimo.
    pub used_session: bool,
}

async fn resolve_post(fetcher: &Fetcher, url: &str) -> Result<(String, Option<String>)> {
    let mut target = super::parse_target(url)
        .ok_or_else(|| anyhow!("cole o link de um post do Reddit (ou o id dele)"))?;
    if let Target::Short { url } = &target {
        let final_url = fetcher.resolve(url).await?;
        target = super::parse_target(&final_url)
            .ok_or_else(|| anyhow!("o link curto não levou a um post ({})", final_url))?;
    }
    match target {
        Target::Post { id, subreddit, .. } => Ok((id, subreddit)),
        _ => Err(anyhow!(
            "isto não é um post: cole o link de uma thread (com /comments/ no meio)"
        )),
    }
}

/// Abre os "carregar mais" até o teto de requisições. Devolve quantos
/// comentários ficaram de fora.
async fn expand(
    fetcher: &Fetcher,
    post_id: &str,

View on GitHub (pinned to 8600b91f42)