tonhowtf/omniget · error

pasta nao encontrada: {}

Error message

pasta nao encontrada: {}

What it means

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.

Solutions

  1. Check the path for typos and confirm it exists on disk
  2. Verify the app has permission to read the directory
  3. Resolve the path before calling scan (e.g. expand ~ and symlinks)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-tauri/omniget-core/src/core/tools/disk.rs:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/disk.rs:118

#[derive(Debug, Clone, Serialize)]
pub struct DiskScan {
    pub root: Node,
    pub largest: Vec<BigFile>,
    pub scanned: u64,
    pub skipped: u64,
}

/// Varre `root` e devolve a árvore até `max_depth` níveis, com no máximo
/// `max_children` filhos por nó (o resto vira "outros").
pub fn scan(
    root: &str,
    max_depth: usize,
    max_children: usize,
    progress: &super::ProgressFn,
) -> anyhow::Result<DiskScan> {
    let root_path = PathBuf::from(root.trim());
    if !root_path.is_dir() {
        anyhow::bail!("pasta nao encontrada: {}", root_path.display());
    }
    let max_depth = max_depth.clamp(1, 8);
    let max_children = max_children.clamp(5, 200);

    // Os maiores arquivos e, por diretório, a lista de filhos diretos com
    // tamanho somado de baixo para cima.
    let mut largest: Vec<BigFile> = Vec::new();
    let mut scanned = 0u64;
    let mut skipped = 0u64;
    let mut last = std::time::Instant::now();

    let walker = walkdir::WalkDir::new(&root_path)
        .follow_links(false)
        .min_depth(1);
    // Pilha "caminho → bytes" para fechar diretórios ao sair deles: walkdir é
    // pré-ordem, então guardamos o acumulado de cada diretório aberto.
    let mut open: Vec<(PathBuf, u64, u64)> = vec![(root_path.clone(), 0, 0)];
    let mut immediate: HashMap<PathBuf, Vec<(String, u64, bool, u64)>> = HashMap::new();

View on GitHub (pinned to 8600b91f42)