sigoden/aichat · error

Unknown kind

Error message

Unknown kind '{kind}'

What it means

Raised by the delete command handler when the 'kind' argument does not match a supported resource type ('role', 'session', 'rag', etc.), each of which maps to a directory and file extension. It is a generic validation guard; the input at fault is the unknown 'kind' string passed to delete().

Solutions

  1. Use a supported kind such as role, session, or rag
  2. Check command documentation for the exact list of deletable resource types
  3. Fix casing or pluralization mistakes in the kind argument
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/config/mod.rs:704 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/41d537d067f9181d. Report an issue: GitHub.

Appendix: source

Thrown at src/config/mod.rs:704

                config.write().save = value;
            }
            "highlight" => {
                let value = value.parse().with_context(|| "Invalid value")?;
                config.write().highlight = value;
            }
            _ => bail!("Unknown key '{key}'"),
        }
        Ok(())
    }

    pub fn delete(config: &GlobalConfig, kind: &str) -> Result<()> {
        let (dir, file_ext) = match kind {
            "role" => (Self::roles_dir(), Some(".md")),
            "session" => (config.read().sessions_dir(), Some(".yaml")),
            "rag" => (Self::rags_dir(), Some(".yaml")),
            "macro" => (Self::macros_dir(), Some(".yaml")),
            "agent-data" => (Self::agents_data_dir(), None),
            _ => bail!("Unknown kind '{kind}'"),
        };
        let names = match read_dir(&dir) {
            Ok(rd) => {
                let mut names = vec![];
                for entry in rd.flatten() {
                    let name = entry.file_name();
                    match file_ext {
                        Some(file_ext) => {
                            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());
                            }
                        }
                    }

View on GitHub (pinned to 82976d349a)