tonhowtf/omniget · error
o source deste arXiv e um PDF, nao tem LaTeX
Error message
o source deste arXiv e um PDF, nao tem LaTeX
What it means
extract_source inspects the first bytes of the e-print payload; if it starts with "%PDF" the "source" arXiv served is actually a rendered PDF, not LaTeX. Since the tool's purpose is to obtain LaTeX, it refuses with this error. This happens for papers whose authors submitted only PDFs (arXiv keeps the PDF as the e-print in that case).
Solutions
- No LaTeX exists for this paper — don't retry; detect the PDF magic bytes client-side and skip it.
- Check the paper's arXiv page for an 'Other formats' / source availability indicator.
- Fall back to PDF text extraction if the goal is just content.
- Inform the user that only a PDF source is available for this id.
Example fix
// before
let bytes = fetch_source(...)?;
let bundle = extract_source(&bytes)?;
// after
let bytes = fetch_source(...)?;
if bytes.starts_with(b"%PDF") {
anyhow::bail!("paper {} so tem PDF, sem LaTeX disponivel", id);
}
let bundle = extract_source(&bytes)?; Defensive patterns
Strategy: fallback
Validate before calling
// antes de extrair LaTeX:
if bytes.starts_with(b"%PDF") {
bail!("paper sem fonte LaTeX (so PDF)");
} Try / catch
match extract_source(&bytes) {
Err(e) if e.to_string().contains("e um PDF") => {
// caminho alternativo: extrair texto do PDF
extract_pdf_text(&bytes)
}
other => other,
} Prevention
- Check the %PDF magic bytes right after download and skip PDF-only papers early.
- Maintain a skip-list of ids known to lack TeX sources.
- Check the paper's arXiv listing page for source availability before fetching.
When it happens
Trigger: Calling fetch_source / extract_source on an arXiv paper that has no TeX submission — authors uploaded a PDF-only submission, so /e-print returns the PDF bytes.
Common situations: Older papers or submissions from fields (e.g. some math/physics scans) where the author never provided TeX; papers replaced with PDF-only versions; trying to extract LaTeX from scanned documents.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- source do arXiv nao parece LaTeX
- o tar do arXiv nao tem nenhum .tex
- nenhum .tex com \begin
- resposta do arXiv sem
- arXiv nao reconheceu o identificador
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/1cd4bd546d2a1dd0.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/arxiv.rs:364
fn is_gzip(b: &[u8]) -> bool {
b.len() > 2 && b[0] == 0x1f && b[1] == 0x8b
}
fn is_tar(b: &[u8]) -> bool {
b.len() > 262 && &b[257..262] == b"ustar"
}
fn gunzip(b: &[u8]) -> anyhow::Result<Vec<u8>> {
use std::io::Read;
let mut out = Vec::new();
flate2::read::GzDecoder::new(b).read_to_end(&mut out)?;
Ok(out)
}
/// Aceita o tar.gz do `e-print`, um tar cru, um `.tex` gzipado ou o `.tex` solto.
pub fn extract_source(bytes: &[u8]) -> anyhow::Result<SourceBundle> {
if bytes.starts_with(b"%PDF") {
return Err(anyhow!("o source deste arXiv e um PDF, nao tem LaTeX"));
}
let raw = if is_gzip(bytes) {
gunzip(bytes)?
} else {
bytes.to_vec()
};
if !is_tar(&raw) {
let text = String::from_utf8_lossy(&raw).to_string();
if !text.contains('\\') {
return Err(anyhow!("source do arXiv nao parece LaTeX"));
}
return Ok(SourceBundle {
main: text,
files: vec!["main.tex".to_string()],
});
}
let mut texts: HashMap<String, String> = HashMap::new();View on GitHub (pinned to 8600b91f42)