sigoden/aichat · error

No to delete

Error message

No {kind} to delete

What it means

Fires in delete() after listing the saved resources of the requested kind: if the directory listing is empty (or unreadable, yielding an empty vec), there is nothing to remove, so the operation aborts. It is an emptiness guard on the collection of names, not a filesystem error itself.

Solutions

  1. Create the resource of this kind first before attempting deletion
  2. Verify the correct kind was specified (role vs session vs rag)
  3. If the directory should contain items, check its path and permissions
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/config/mod.rs:731 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09). Data as JSON: /api/errors/9aed064fc973f91e. Report an issue: GitHub.

Appendix: source

Thrown at src/config/mod.rs:731

                            if let Some(name) = name.to_string_lossy().strip_suffix(file_ext) {
                                names.push(name.to_string());
                            }
                        }
                        None => {
                            if entry.path().is_dir() {
                                names.push(name.to_string_lossy().to_string());
                            }
                        }
                    }
                }
                names.sort_unstable();
                names
            }
            Err(_) => vec![],
        };

        if names.is_empty() {
            bail!("No {kind} to delete")
        }

        let select_names = MultiSelect::new(&format!("Select {kind} to delete:"), names)
            .with_validator(|list: &[ListOption<&String>]| {
                if list.is_empty() {
                    Ok(Validation::Invalid(
                        "At least one item must be selected".into(),
                    ))
                } else {
                    Ok(Validation::Valid)
                }
            })
            .prompt()?;

        for name in select_names {
            match file_ext {
                Some(ext) => {
                    let path = dir.join(format!("{name}{ext}"));

View on GitHub (pinned to 82976d349a)