{"record":{"id":"ae681abe5f4d41ff","repo":"tonhowtf/omniget","slug":"nao-reconheci-um-id-de-arxiv-em","errorCode":null,"errorMessage":"nao reconheci um id de arXiv em: {}","messagePattern":"nao reconheci um id de arXiv em: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/arxiv.rs","lineNumber":1132,"sourceCode":"    pub body_source: String,\n    pub path: Option<String>,\n    pub chars: u64,\n    pub math_blocks: u64,\n    pub source_files: Vec<String>,\n    /// Por que caiu para uma fonte pior, quando caiu.\n    pub fallback_reason: Option<String>,\n}\n\nfn count_math(md: &str) -> u64 {\n    split_math(md)\n        .iter()\n        .filter(|s| matches!(s, Span::Math(_)))\n        .count() as u64\n}\n\npub async fn fetch(opts: Options, p: ProgressFn) -> anyhow::Result<ArxivDoc> {\n    let r = parse_id(&opts.input)\n        .ok_or_else(|| anyhow!(\"nao reconheci um id de arXiv em: {}\", opts.input.trim()))?;\n    report(&p, ID, \"started\", 0, Some(3), Some(r.full()));\n\n    let client = super::client()?;\n    let url = format!(\"{}{}\", API, r.full());\n    let xml = client\n        .get(&url)\n        .send()\n        .await?\n        .error_for_status()?\n        .text()\n        .await?;\n    let mut meta = parse_atom(&xml)?;\n    if meta.version.is_none() {\n        meta.version = r.version;\n    }\n    report(&p, ID, \"progress\", 1, Some(3), Some(meta.title.clone()));\n\n    let prefer = if opts.prefer.is_empty() {","sourceCodeStart":1114,"sourceCodeEnd":1150,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/arxiv.rs#L1114-L1150","documentation":"fetch() starts by running parse_id on opts.input; if the input string does not match any recognized arXiv identifier format (modern 2101.12345, old quant-ph/9901001, full abs URL, etc.), it fails with this message echoing the trimmed input. It is a client-side pre-flight validation before any network request.","triggerScenarios":"Calling fetch with a DOI, title, bibkey, malformed URL, extra whitespace/characters, or a paper id with unsupported prefix (e.g. SSRN or bioRxiv ids).","commonSituations":"User pastes a DOI (10.xxxx/...) or a Google Scholar link instead of an arXiv id; copies a PDF download URL rather than the abs page; typos like 'arXiv: 1706.03762' with a space or missing digits.","solutions":["Check the echoed input in the message and correct it to a valid arXiv id (e.g. 1706.03762 or https://arxiv.org/abs/1706.03762).","Run parse_id on the input yourself first to get a precise reason and show the accepted formats to the user.","Strip surrounding decorations like 'arXiv:' prefix, version suffixes, or trailing punctuation before calling.","If the input is a DOI, resolve it to an arXiv id via arXiv's metadata or reject it explicitly."],"exampleFix":"// before\nlet r = parse_id(&opts.input)\n    .ok_or_else(|| anyhow!(\"nao reconheci um id de arXiv em: {}\", opts.input.trim()))?;\n// after\nlet cleaned = opts.input.trim().trim_start_matches(\"arXiv:\").trim();\nlet r = parse_id(cleaned)\n    .ok_or_else(|| anyhow!(\"nao reconheci um id de arXiv em: '{}' (esperado ex.: 1706.03762 ou quant-ph/9901001)\", cleaned))?;","handlingStrategy":"validation","validationCode":"// antes de chamar fetch:\nfn e_id_arxiv(s: &str) -> bool {\n    let s = s.trim().trim_start_matches(\"arXiv:\").trim();\n    regex::Regex::new(r\"^(\\d{4}\\.\\d{4,5}(v\\d+)?|[a-z-]+/\\d{7}(v\\d+)?)$\").unwrap().is_match(s)\n}","typeGuard":null,"tryCatchPattern":"match fetch(opts).await {\n    Err(e) if e.to_string().contains(\"nao reconheci um id\") => {\n        eprintln!(\"entrada invalida: use 1706.03762 ou https://arxiv.org/abs/1706.03762\");\n    }\n    other => other,\n}","preventionTips":["Normalize user input: strip 'arXiv:' prefix, whitespace, and trailing punctuation.","Accept full abs URLs and extract the id before calling fetch.","Show accepted id formats in your UI/CLI help to reduce paste errors.","Reject non-arXiv identifiers (DOIs, bioRxiv) explicitly with a clear message."],"tags":["arxiv","identifier","input-validation","invalid-argument"],"backgroundTag":"invalid-identifier-format","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"}