tonhowtf/omniget · error

o tar do arXiv nao tem nenhum .tex

Error message

o tar do arXiv nao tem nenhum .tex

What it means

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.

Solutions

  1. Confirm the paper's source format on its arXiv page; if it's Word/non-TeX, LaTeX extraction is impossible.
  2. Check tar entry names — if they use uppercase .TEX, make the filter case-insensitive.
  3. Skip this paper or ask arXiv for the source listing before attempting extraction.
  4. If the tar has .tex inside subdirectories under different extensions (e.g. .ltx), extend the filter.

Example fix

// before
if texts.is_empty() {
    return Err(anyhow!("o tar do arXiv nao tem nenhum .tex"));
}
// after
if texts.is_empty() {
    return Err(anyhow!("o tar do arXiv nao tem nenhum .tex (entradas: {:?})", names));
}
// or accept case variants:
// filter(|p| p.extension().map_or(false, |e| e.eq_ignore_ascii_case("tex")))
Defensive patterns

Strategy: validation

Validate before calling

// inspecione o tar antes:
let tex_count = entries.iter().filter(|n| n.to_lowercase().ends_with(".tex")).count();
if tex_count == 0 { bail!("tar sem .tex: {:?}", entries); }

Try / catch

match extract_source(&bytes) {
    Err(e) if e.to_string().contains("nenhum .tex") => {
        eprintln!("submissao sem TeX (Word/figuras?); pulando");
    }
    other => other,
}

Prevention

When it happens

Trigger: extract_source receives a valid, untarable tar.gz whose entries contain no .tex filenames — e.g. a DOCX-only or figures-only submission.

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

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/arxiv.rs:399

    let mut texts: HashMap<String, String> = HashMap::new();
    let mut names: Vec<String> = Vec::new();
    let mut archive = tar::Archive::new(std::io::Cursor::new(&raw));
    for entry in archive.entries()? {
        let mut entry = entry?;
        let path = entry.path()?.to_string_lossy().to_string();
        let lower = path.to_lowercase();
        if !(lower.ends_with(".tex") || lower.ends_with(".bbl") || lower.ends_with(".ltx")) {
            continue;
        }
        let mut buf = Vec::new();
        use std::io::Read;
        entry.read_to_end(&mut buf)?;
        names.push(path.clone());
        texts.insert(path, String::from_utf8_lossy(&buf).to_string());
    }
    if texts.is_empty() {
        return Err(anyhow!("o tar do arXiv nao tem nenhum .tex"));
    }

    let main_key =
        pick_main(&texts).ok_or_else(|| anyhow!("nenhum .tex com \\begin{{document}}"))?;
    let main = texts.get(&main_key).cloned().unwrap_or_default();
    let main = resolve_inputs(&main, &texts, 0);
    names.sort();
    Ok(SourceBundle { main, files: names })
}

fn pick_main(texts: &HashMap<String, String>) -> Option<String> {
    let mut best: Option<(u32, usize, String)> = None;
    for (k, v) in texts {
        if !k.to_lowercase().ends_with(".tex") && !k.to_lowercase().ends_with(".ltx") {
            continue;
        }
        let mut score = 0u32;
        if v.contains("\\begin{document}") {

View on GitHub (pinned to 8600b91f42)