sigoden/aichat · error

Function calling cannot be enabled because no functions are…

Error message

Function calling cannot be enabled because no functions are installed.

What it means

Fires in update() when setting function_calling to true while the configuration has no functions installed (config.functions is empty). The guard prevents enabling function calling in a state where the model would have no tools to call; the input at fault is the value 'true' for the function_calling key.

Solutions

  1. Install or define at least one function before enabling function calling
  2. Leave function_calling disabled if no functions are needed
  3. Check the functions directory configuration if functions were expected to be present
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

Thrown at src/config/mod.rs:676

                let value = parse_value(value)?;
                config.write().set_compress_threshold(value);
            }
            "rag_reranker_model" => {
                let value = parse_value(value)?;
                Self::set_rag_reranker_model(config, value)?;
            }
            "rag_top_k" => {
                let value = value.parse().with_context(|| "Invalid value")?;
                Self::set_rag_top_k(config, value)?;
            }
            "dry_run" => {
                let value = value.parse().with_context(|| "Invalid value")?;
                config.write().dry_run = value;
            }
            "function_calling" => {
                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(())

View on GitHub (pinned to 82976d349a)