sigoden/aichat · error

The following agent variables are required

Error message

The following agent variables are required:
{}

What it means

Validation guard during interactive agent-variable initialization: some required variables declared in the agent definition were not supplied (unset after prompting), so the agent cannot start because its functions depend on those values. The listed names are the agent's required variables that received no value.

Solutions

  1. Re-run the agent and provide values for each listed variable when prompted
  2. Pre-set the required variables in configuration or environment so interactive prompting is not needed
  3. If a variable is genuinely optional, mark it as such in the agent definition instead of leaving it required
  4. Abort cleanly and show the list before exit so the user knows exactly what to supply next time
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/config/agent.rs:171 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/05732e8d709bad10. Report an issue: GitHub.

Appendix: source

Thrown at src/config/agent.rs:171

                            agent_variable.name, agent_variable.description
                        ))
                        .with_validator(|input: &str| {
                            if input.trim().is_empty() {
                                Ok(Validation::Invalid("This field is required".into()))
                            } else {
                                Ok(Validation::Valid)
                            }
                        })
                        .prompt()?;
                        output.insert(key, value);
                    } else {
                        unset_variables.push(agent_variable)
                    }
                }
            }
        }
        if !unset_variables.is_empty() {
            bail!(
                "The following agent variables are required:\n{}",
                unset_variables
                    .iter()
                    .map(|v| format!("  - {}: {}", v.name, v.description))
                    .collect::<Vec<_>>()
                    .join("\n")
            )
        }
        Ok(output)
    }

    pub fn export(&self) -> Result<String> {
        let mut value = json!({});
        value["name"] = json!(self.name());
        let variables = self.variables();
        if !variables.is_empty() {
            value["variables"] = serde_json::to_value(variables)?;
        }

View on GitHub (pinned to 82976d349a)