{"record":{"id":"7d623b8a5f4ea753","repo":"tonhowtf/omniget","slug":"o-tar-do-arxiv-nao-tem-nenhum-tex","errorCode":null,"errorMessage":"o tar do arXiv nao tem nenhum .tex","messagePattern":"o tar do arXiv nao tem nenhum \\.tex","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/arxiv.rs","lineNumber":399,"sourceCode":"\n    let mut texts: HashMap<String, String> = HashMap::new();\n    let mut names: Vec<String> = Vec::new();\n    let mut archive = tar::Archive::new(std::io::Cursor::new(&raw));\n    for entry in archive.entries()? {\n        let mut entry = entry?;\n        let path = entry.path()?.to_string_lossy().to_string();\n        let lower = path.to_lowercase();\n        if !(lower.ends_with(\".tex\") || lower.ends_with(\".bbl\") || lower.ends_with(\".ltx\")) {\n            continue;\n        }\n        let mut buf = Vec::new();\n        use std::io::Read;\n        entry.read_to_end(&mut buf)?;\n        names.push(path.clone());\n        texts.insert(path, String::from_utf8_lossy(&buf).to_string());\n    }\n    if texts.is_empty() {\n        return Err(anyhow!(\"o tar do arXiv nao tem nenhum .tex\"));\n    }\n\n    let main_key =\n        pick_main(&texts).ok_or_else(|| anyhow!(\"nenhum .tex com \\\\begin{{document}}\"))?;\n    let main = texts.get(&main_key).cloned().unwrap_or_default();\n    let main = resolve_inputs(&main, &texts, 0);\n    names.sort();\n    Ok(SourceBundle { main, files: names })\n}\n\nfn pick_main(texts: &HashMap<String, String>) -> Option<String> {\n    let mut best: Option<(u32, usize, String)> = None;\n    for (k, v) in texts {\n        if !k.to_lowercase().ends_with(\".tex\") && !k.to_lowercase().ends_with(\".ltx\") {\n            continue;\n        }\n        let mut score = 0u32;\n        if v.contains(\"\\\\begin{document}\") {","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/arxiv.rs#L381-L417","documentation":"After unpacking the arXiv tar, extract_source collects only .tex entries into `texts`. If the tar contained no .tex files at all, it fails with this error. arXiv sources may legitimately be entirely non-TeX (e.g. Word/DOCX or plain figures), which this tool does not support.","triggerScenarios":"extract_source receives a valid, untarable tar.gz whose entries contain no .tex filenames — e.g. a DOCX-only or figures-only submission.","commonSituations":"Papers submitted to arXiv as Microsoft Word documents; submissions containing only ancillary files or images; tar entries using unusual extensions (.TEX uppercase is handled only if the filter is case-insensitive — check that).","solutions":["Confirm the paper's source format on its arXiv page; if it's Word/non-TeX, LaTeX extraction is impossible.","Check tar entry names — if they use uppercase .TEX, make the filter case-insensitive.","Skip this paper or ask arXiv for the source listing before attempting extraction.","If the tar has .tex inside subdirectories under different extensions (e.g. .ltx), extend the filter."],"exampleFix":"// before\nif texts.is_empty() {\n    return Err(anyhow!(\"o tar do arXiv nao tem nenhum .tex\"));\n}\n// after\nif texts.is_empty() {\n    return Err(anyhow!(\"o tar do arXiv nao tem nenhum .tex (entradas: {:?})\", names));\n}\n// or accept case variants:\n// filter(|p| p.extension().map_or(false, |e| e.eq_ignore_ascii_case(\"tex\")))","handlingStrategy":"validation","validationCode":"// inspecione o tar antes:\nlet tex_count = entries.iter().filter(|n| n.to_lowercase().ends_with(\".tex\")).count();\nif tex_count == 0 { bail!(\"tar sem .tex: {:?}\", entries); }","typeGuard":null,"tryCatchPattern":"match extract_source(&bytes) {\n    Err(e) if e.to_string().contains(\"nenhum .tex\") => {\n        eprintln!(\"submissao sem TeX (Word/figuras?); pulando\");\n    }\n    other => other,\n}","preventionTips":["List tar entry names when this fails — it reveals the real source format.","Make the .tex filter case-insensitive to catch .TEX entries.","Skip papers whose arXiv source listing shows no TeX files."],"tags":["arxiv","latex","tar","empty-result"],"backgroundTag":"empty-result-set","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"}