sigoden/aichat · error

Unknown key

Error message

Unknown key '{key}'

What it means

The catch-all arm of the key match in update(): any .set key that is not one of the recognized configuration keys (model, compress_threshold, rag_*, dry_run, function_calling, stream, save, highlight, etc.) triggers this generic validation guard. The input at fault is the unrecognized 'key' string.

Solutions

  1. Check the spelling of the key against the list of supported configuration keys
  2. Use the config list/display output to see valid key names
  3. If a newer key is expected, update the application to a version that supports it
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at src/config/mod.rs:692

                let value = value.parse().with_context(|| "Invalid value")?;
                if value && config.write().functions.is_empty() {
                    bail!("Function calling cannot be enabled because no functions are installed.")
                }
                config.write().function_calling = value;
            }
            "stream" => {
                let value = value.parse().with_context(|| "Invalid value")?;
                config.write().stream = value;
            }
            "save" => {
                let value = value.parse().with_context(|| "Invalid value")?;
                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();

View on GitHub (pinned to 82976d349a)