tonhowtf/omniget · error

nao achei os arquivos data/*.js do arquivo do X

Error message

nao achei os arquivos data/*.js do arquivo do X

What it means

X archive parsing (open) collects the data/*.js files (tweets.js, tweets-part1.js, etc.) from an exported X/Twitter archive. If after extraction none of those data files were found, it errors, meaning the zip either is not a genuine X data export or has an unexpected internal layout.

Solutions

  1. Request the full X data export (Settings > Your account > Download an archive) and use the untouched zip.
  2. Open the zip and confirm a data/ directory containing *.js files (tweets.js etc.) exists at the expected path.
  3. Re-download the archive if the zip is truncated or corrupted.
  4. Do not re-zip with an extra top-level folder; keep the original structure.
Defensive patterns

Strategy: validation

Validate before calling

// before open(), sanity-check the zip contents
let names = zip_entries(path)?;
if !names.iter().any(|n| n.starts_with("data/") && n.ends_with(".js")) {
    return Err(UserError::NotAnXArchive);
}
let archive = XArchive::open(path)?;

Type guard

fn looks_like_x_archive(entries: &[String]) -> bool {
    entries.iter().any(|n| n.starts_with("data/") && n.ends_with(".js"))
}

Try / catch

match XArchive::open(path) {
    Ok(a) => use(a),
    Err(e) if e.to_string().contains("data/*.js") => show_dialog("This zip is not a full X data export; download the archive from Settings > Your account."),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling XArchive::open with a zip that contains no entries matching the data/*.js layout — wrong file selected, re-zipped archive with a wrapper folder, or a different export type (e.g. only 'assets').

Common situations: User uploads the wrong export (e.g. the 'tweet media' zip instead of the full data export); archives re-compressed by tools that dropped or renamed the data folder; corrupted/partial downloads.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/x/archive.rs:96

                }
            }
        } else {
            let f = std::fs::File::open(p)?;
            let mut zip = zip::ZipArchive::new(f)?;
            for i in 0..zip.len() {
                let mut entry = zip.by_index(i)?;
                let full = entry.name().to_string();
                let name = full.rsplit('/').next().unwrap_or(&full).to_string();
                if full.contains("data/") && name.ends_with(".js") && wanted(&name) {
                    let mut s = String::new();
                    if entry.read_to_string(&mut s).is_ok() {
                        files.insert(name, s);
                    }
                }
            }
        }
        if files.is_empty() {
            return Err(anyhow!("nao achei os arquivos data/*.js do arquivo do X"));
        }
        Ok(Self { files })
    }

    /// `tweets.js`, `tweets-part1.js`… concatenados em ordem.
    fn json(&self, base: &str) -> Vec<Value> {
        let mut names: Vec<&String> = self
            .files
            .keys()
            .filter(|n| *n == &format!("{}.js", base) || n.starts_with(&format!("{}-part", base)))
            .collect();
        names.sort();
        let mut out = Vec::new();
        for n in names {
            let s = &self.files[n];
            let Some(i) = s.find('=') else { continue };
            if let Ok(Value::Array(a)) =
                serde_json::from_str::<Value>(s[i + 1..].trim().trim_end_matches(';'))

View on GitHub (pinned to 8600b91f42)