{"record":{"id":"05732e8d709bad10","repo":"sigoden/aichat","slug":"the-following-agent-variables-are-required","errorCode":null,"errorMessage":"The following agent variables are required:\n{}","messagePattern":"The following agent variables are required:\n(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/agent.rs","lineNumber":171,"sourceCode":"                            agent_variable.name, agent_variable.description\n                        ))\n                        .with_validator(|input: &str| {\n                            if input.trim().is_empty() {\n                                Ok(Validation::Invalid(\"This field is required\".into()))\n                            } else {\n                                Ok(Validation::Valid)\n                            }\n                        })\n                        .prompt()?;\n                        output.insert(key, value);\n                    } else {\n                        unset_variables.push(agent_variable)\n                    }\n                }\n            }\n        }\n        if !unset_variables.is_empty() {\n            bail!(\n                \"The following agent variables are required:\\n{}\",\n                unset_variables\n                    .iter()\n                    .map(|v| format!(\"  - {}: {}\", v.name, v.description))\n                    .collect::<Vec<_>>()\n                    .join(\"\\n\")\n            )\n        }\n        Ok(output)\n    }\n\n    pub fn export(&self) -> Result<String> {\n        let mut value = json!({});\n        value[\"name\"] = json!(self.name());\n        let variables = self.variables();\n        if !variables.is_empty() {\n            value[\"variables\"] = serde_json::to_value(variables)?;\n        }","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/config/agent.rs#L153-L189","documentation":"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.","triggerScenarios":"Thrown at src/config/agent.rs:171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-run the agent and provide values for each listed variable when prompted","Pre-set the required variables in configuration or environment so interactive prompting is not needed","If a variable is genuinely optional, mark it as such in the agent definition instead of leaving it required","Abort cleanly and show the list before exit so the user knows exactly what to supply next time"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}