{"record":{"id":"2936cd1b4bd3c546","repo":"tonhowtf/omniget","slug":"o-export-veio-sem-nenhum-livro","errorCode":null,"errorMessage":"o export veio sem nenhum livro","messagePattern":"o export veio sem nenhum livro","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/lists/goodreads.rs","lineNumber":537,"sourceCode":"            std::fs::read_to_string(path).with_context(|| format!(\"não consegui ler {}\", path))?,\n            path.to_string(),\n            0,\n        ),\n        _ => {\n            if !f.has_session() {\n                return Err(anyhow!(\n                    \"sem sessão do Goodreads: capture os cookies de goodreads.com na extensão, ou aponte o goodreads_library_export.csv que você já baixou\"\n                ));\n            }\n            let (csv, secs) = trigger_and_wait(&f, opts, &p).await?;\n            let _ = std::fs::write(dest.join(\"goodreads_library_export.csv\"), &csv);\n            (csv, EXPORT_BASE.to_string(), secs)\n        }\n    };\n\n    let mut entries = parse_export_csv(&csv);\n    if entries.is_empty() {\n        return Err(anyhow!(\"o export veio sem nenhum livro\"));\n    }\n\n    // Reviews que o CSV não trouxe, buscadas na prateleira.\n    let mut enriched = 0usize;\n    if !opts.enrich_shelves.is_empty() && f.has_session() {\n        let page = f.get_text(IMPORT_URL).await.unwrap_or_default();\n        match user_id(&page) {\n            None => tracing::debug!(\"gr-export: não achei o id do usuário; pulei o enriquecimento\"),\n            Some(uid) => {\n                let mut found: HashMap<String, String> = HashMap::new();\n                for shelf in &opts.enrich_shelves {\n                    for page_n in 1..=opts.max_pages.max(1) {\n                        report(\n                            &p,\n                            TOOL_ID,\n                            \"progress\",\n                            page_n as u64,\n                            Some(opts.max_pages as u64),","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/lists/goodreads.rs#L519-L555","documentation":"Thrown after the tool parses the Goodreads CSV export with parse_export_csv: if the parsed entry list is empty — meaning no book rows were recognized — run() aborts. The CSV may exist and even contain 'title', but zero books were extracted from it.","triggerScenarios":"Calling run with an export file that has headers but no data rows (e.g. an account with an empty library), a truncated/corrupt CSV, or a CSV whose columns don't match what parse_export_csv expects.","commonSituations":"User selected the wrong CSV file (some other tool's export that happens to contain 'title'); freshly created Goodreads account with no books; partial download cut off mid-file; Goodreads changed column names so the parser matches nothing.","solutions":["Open the CSV and confirm it contains book rows beyond the header line.","Re-export from goodreads.com/review/import to get a complete, current file.","Check whether the Goodreads export format changed and update parse_export_csv's column mapping.","Ensure you're passing the correct file (goodreads_library_export.csv), not another CSV."],"exampleFix":"// before\nlet csv = std::fs::read_to_string(\"some_other_export.csv\")?;\nrun(&opts, p).await?;\n// after\nlet csv = std::fs::read_to_string(\"goodreads_library_export.csv\")?;\nassert!(csv.lines().count() > 1, \"export has no data rows\");\nrun(&opts, p).await?;","handlingStrategy":"validation","validationCode":"let csv = std::fs::read_to_string(\"goodreads_library_export.csv\")?;\nlet data_rows = csv.lines().skip(1).filter(|l| !l.trim().is_empty()).count();\nanyhow::ensure!(data_rows > 0, \"export do Goodreads não tem livros: {data_rows} linhas de dados\");","typeGuard":"fn goodreads_export_has_rows(csv: &str) -> bool {\n    csv.lines().skip(1).any(|l| !l.trim().is_empty())\n}","tryCatchPattern":"match run(&opts, &p).await {\n    Err(e) if e.to_string().contains(\"sem nenhum livro\") => {\n        eprintln!(\"o CSV está vazio ou ilegível — re-exporte em goodreads.com/review/import\");\n    }\n    other => other?,\n}","preventionTips":["Open the CSV in a spreadsheet and confirm rows exist before running the tool","Always export a fresh file from goodreads.com/review/import rather than reusing old ones","Verify the file is the official goodreads_library_export.csv, not another CSV","Watch for Goodreads format changes and keep the tool updated"],"tags":["goodreads","csv","empty","parsing"],"backgroundTag":"empty-result-set","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"}