{"record":{"id":"d8af7a5a26fb67cc","repo":"tonhowtf/omniget","slug":"pasta-nao-encontrada","errorCode":null,"errorMessage":"pasta nao encontrada: {}","messagePattern":"pasta nao encontrada: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/disk.rs","lineNumber":118,"sourceCode":"#[derive(Debug, Clone, Serialize)]\npub struct DiskScan {\n    pub root: Node,\n    pub largest: Vec<BigFile>,\n    pub scanned: u64,\n    pub skipped: u64,\n}\n\n/// Varre `root` e devolve a árvore até `max_depth` níveis, com no máximo\n/// `max_children` filhos por nó (o resto vira \"outros\").\npub fn scan(\n    root: &str,\n    max_depth: usize,\n    max_children: usize,\n    progress: &super::ProgressFn,\n) -> anyhow::Result<DiskScan> {\n    let root_path = PathBuf::from(root.trim());\n    if !root_path.is_dir() {\n        anyhow::bail!(\"pasta nao encontrada: {}\", root_path.display());\n    }\n    let max_depth = max_depth.clamp(1, 8);\n    let max_children = max_children.clamp(5, 200);\n\n    // Os maiores arquivos e, por diretório, a lista de filhos diretos com\n    // tamanho somado de baixo para cima.\n    let mut largest: Vec<BigFile> = Vec::new();\n    let mut scanned = 0u64;\n    let mut skipped = 0u64;\n    let mut last = std::time::Instant::now();\n\n    let walker = walkdir::WalkDir::new(&root_path)\n        .follow_links(false)\n        .min_depth(1);\n    // Pilha \"caminho → bytes\" para fechar diretórios ao sair deles: walkdir é\n    // pré-ordem, então guardamos o acumulado de cada diretório aberto.\n    let mut open: Vec<(PathBuf, u64, u64)> = vec![(root_path.clone(), 0, 0)];\n    let mut immediate: HashMap<PathBuf, Vec<(String, u64, bool, u64)>> = HashMap::new();","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/disk.rs#L100-L136","documentation":"Guard clause in the disk-usage scan: scan() bails out before walking anything when the root path (after trimming whitespace) does not exist as a directory on disk. It fires when the user (or the tree command calling it) supplies a root that is missing, a file instead of a directory, or an empty/blank string resolved to a non-directory path. The {} placeholder carries the offending path as displayed by PathBuf::display.","triggerScenarios":"Thrown at src-tauri/omniget-core/src/core/tools/disk.rs:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the path for typos and confirm it exists on disk","Verify the app has permission to read the directory","Resolve the path before calling scan (e.g. expand ~ and symlinks)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}