{"record":{"id":"2ae091d6ebe8791f","repo":"tonhowtf/omniget","slug":"n-o-consegui-ler-a-lista","errorCode":null,"errorMessage":"não consegui ler a lista {}: {}","messagePattern":"não consegui ler a lista (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tiktok/download.rs","lineNumber":155,"sourceCode":"        return Some(PathBuf::from(c));\n    }\n    session.path().map(|p| p.to_path_buf())\n}\n\npub async fn run(opts: &Options, progress: ProgressFn) -> Result<DownloadResult> {\n    let dest = PathBuf::from(&opts.dest);\n    if opts.dest.trim().is_empty() {\n        return Err(anyhow!(\"escolha a pasta de destino\"));\n    }\n    std::fs::create_dir_all(&dest)?;\n\n    let session = TempCookies::new(opts.session_netscape.as_deref());\n    let used_session = session.is_some();\n    let cookies = cookies_path(opts, &session);\n\n    let list_text = match opts.list_file.as_deref().filter(|p| !p.trim().is_empty()) {\n        Some(path) => std::fs::read_to_string(path)\n            .map_err(|e| anyhow!(\"não consegui ler a lista {}: {}\", path, e))?,\n        None => String::new(),\n    };\n    let mut queue = queue_from_text(&opts.urls, &list_text, 0);\n\n    if let Some(profile) = opts.profile.as_deref().filter(|p| !p.trim().is_empty()) {\n        report(\n            &progress,\n            ID,\n            \"progress\",\n            0,\n            None,\n            Some(format!(\"lendo {}\", profile)),\n        );\n        for url in expand_profile(profile, opts.limit, cookies.as_deref()).await? {\n            if !queue.contains(&url) {\n                queue.push(url);\n            }\n        }","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tiktok/download.rs#L137-L173","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nlet opts = Options { list_file: Some(\"old/list.txt\".into()), .. };\n// after\nlet path = Path::new(\"list.txt\");\nif path.exists() {\n    let opts = Options { list_file: Some(path.to_string_lossy().into()), .. };\n}","handlingStrategy":"validation","validationCode":"let path = opts.list_file.as_deref().unwrap_or_default();\nif !path.trim().is_empty() {\n    let p = std::path::Path::new(path);\n    if !p.is_file() { return Err(format!(\"list file missing: {path}\")); }\n    std::fs::read(p)?; // fail early with a clear error\n}","typeGuard":null,"tryCatchPattern":"match run(&opts, progress).await {\n    Err(e) if e.to_string().contains(\"não consegui ler a lista\") => {\n        // inspect io error kind in message; recreate or re-pick the list file\n    }\n    other => other,\n}","preventionTips":["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"],"tags":["tiktok","file-read","io-error","utf8","rust"],"backgroundTag":"file-read-failed","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"}