sigoden/aichat · error
No return value from '_instructions' function
Error message
No return value from '_instructions' function
What it means
Guard in the dynamic-instructions path: the agent's '_instructions' LLM function was invoked to generate instructions at runtime, but it returned no value (None), so there is nothing to store as the dynamic instruction text. The fault is in the agent's function definition — it fails to return any output for the empty '{}' arguments it is called with.
Solutions
- Fix the '_instructions' function in the agent's functions directory so it always returns a string
- Test the function directly with '{}' arguments to reproduce the empty return
- Add a default/fallback instruction text to use when the function yields nothing, so agent init does not hard-fail
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/config/agent.rs:322 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/351c755a0dff3216.
Report an issue: GitHub.
Appendix: source
Thrown at src/config/agent.rs:322
if self.is_dynamic_instructions() {
let value = match value {
Some(v) => v,
None => self.run_instructions_fn()?,
};
self.session_dynamic_instructions = Some(value);
}
Ok(())
}
fn run_instructions_fn(&self) -> Result<String> {
let value = run_llm_function(
self.name().to_string(),
vec!["_instructions".into(), "{}".into()],
self.variable_envs(),
)?;
match value {
Some(v) => Ok(v),
_ => bail!("No return value from '_instructions' function"),
}
}
}
impl RoleLike for Agent {
fn to_role(&self) -> Role {
let prompt = self.interpolated_instructions();
let mut role = Role::new("", &prompt);
role.sync(self);
role
}
fn model(&self) -> &Model {
&self.model
}
fn temperature(&self) -> Option<f64> {
self.config.temperatureView on GitHub (pinned to 82976d349a)