tonhowtf/omniget · error · anyhow::Error
não consegui ler a lista
Error message
não consegui ler a lista {}: {} What it means
When opts.list_file is set, run reads it with std::fs::read_to_string; any io::Error is wrapped as "não consegui ler a lista {path}: {e}" (couldn't read the list). The underlying OS error is interpolated, so the root cause (NotFound, PermissionDenied, etc.) is in the message.
Solutions
- Check the file exists and is readable before calling run (Path::exists / metadata)
- Verify the list file is valid UTF-8 (re-save as UTF-8)
- Read the interpolated io::Error kind and handle NotFound vs PermissionDenied distinctly
- Use read_to_string on the correct file path, not a directory
Example fix
// before
let opts = Options { list_file: Some("old/list.txt".into()), .. };
// after
let path = Path::new("list.txt");
if path.exists() {
let opts = Options { list_file: Some(path.to_string_lossy().into()), .. };
} Defensive patterns
Strategy: validation
Validate before calling
let path = opts.list_file.as_deref().unwrap_or_default();
if !path.trim().is_empty() {
let p = std::path::Path::new(path);
if !p.is_file() { return Err(format!("list file missing: {path}")); }
std::fs::read(p)?; // fail early with a clear error
} Try / catch
match run(&opts, progress).await {
Err(e) if e.to_string().contains("não consegui ler a lista") => {
// inspect io error kind in message; recreate or re-pick the list file
}
other => other,
} Prevention
- Re-export list files as UTF-8 (no BOM/UTF-16)
- Verify the list file path before starting a batch download
- Keep list files in app-controlled directories to avoid permission issues
- Treat read errors as fatal with the path included in user-facing messages
When it happens
Trigger: Calling run with opts.list_file pointing at a file that doesn't exist, is a directory, lacks read permission, contains invalid UTF-8 (read_to_string fails on non-UTF-8), or is locked by another process.
Common situations: Stale path after the list file was moved/deleted; exporting the list as UTF-16 or with BOM breaking UTF-8 decoding; permission issues reading from another user's folder; passing a directory path instead of a file.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- nao leu
- não foi possível iniciar o yt-dlp
- ffmpeg nao iniciou
- não reconheci esse perfil ou coleção
- isso é um vídeo, não um perfil
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/2ae091d6ebe8791f.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/tiktok/download.rs:155
return Some(PathBuf::from(c));
}
session.path().map(|p| p.to_path_buf())
}
pub async fn run(opts: &Options, progress: ProgressFn) -> Result<DownloadResult> {
let dest = PathBuf::from(&opts.dest);
if opts.dest.trim().is_empty() {
return Err(anyhow!("escolha a pasta de destino"));
}
std::fs::create_dir_all(&dest)?;
let session = TempCookies::new(opts.session_netscape.as_deref());
let used_session = session.is_some();
let cookies = cookies_path(opts, &session);
let list_text = match opts.list_file.as_deref().filter(|p| !p.trim().is_empty()) {
Some(path) => std::fs::read_to_string(path)
.map_err(|e| anyhow!("não consegui ler a lista {}: {}", path, e))?,
None => String::new(),
};
let mut queue = queue_from_text(&opts.urls, &list_text, 0);
if let Some(profile) = opts.profile.as_deref().filter(|p| !p.trim().is_empty()) {
report(
&progress,
ID,
"progress",
0,
None,
Some(format!("lendo {}", profile)),
);
for url in expand_profile(profile, opts.limit, cookies.as_deref()).await? {
if !queue.contains(&url) {
queue.push(url);
}
}View on GitHub (pinned to 8600b91f42)