sigoden/aichat · error

Invalid starter value

Error message

Invalid starter value

What it means

The `.starter` REPL command loads the agent's starter prompt and feeds it to the session; when the agent has no starter text configured (`starter` is None), the command bails with 'Invalid starter value'. The library requires a non-empty starter string to execute this command.

Solutions

  1. Set a `starter` value in the active agent's configuration
  2. Use a different agent that defines a starter before running .starter
  3. Use normal chat input instead of .starter when no starter is configured

Example fix

// agents/myagent.yml — before
name: myagent
// after
name: myagent
starter: "Summarize this repository"
Defensive patterns

Strategy: validation

Validate before calling

let has_starter = agent_config
    .get("starter")
    .map(|s| !s.as_str().unwrap_or("").is_empty())
    .unwrap_or(false);
if !has_starter { eprintln!("Agent has no starter; .starter will fail"); }

Type guard

fn agent_has_starter(cfg: &AgentConfig) -> bool {
    cfg.starter.as_deref().map(|s| !s.trim().is_empty()).unwrap_or(false)
}

Try / catch

if let Err(e) = run_repl_command(...).await {
    if e.to_string() == "Invalid starter value" {
        eprintln!("This agent has no starter configured; set `starter:` in the agent config");
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Running `.starter` while the active agent's configuration has no `starter` field set (or it resolves to None).

Common situations: Switching to an agent whose config lacks a starter prompt; a typo or empty string in the agent's starter configuration; using .starter on a built-in agent that defines no starter.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of sigoden/aichat@82976d349a (2026-09-09). Data as JSON: /api/errors/ea0e568be9c03c64. Report an issue: GitHub.

Appendix: source

Thrown at src/repl/mod.rs:498

            },
            ".starter" => match args {
                Some(id) => {
                    let mut text = None;
                    if let Some(agent) = config.read().agent.as_ref() {
                        for (i, value) in agent.conversation_staters().iter().enumerate() {
                            if (i + 1).to_string() == id {
                                text = Some(value.clone());
                            }
                        }
                    }
                    match text {
                        Some(text) => {
                            println!("{}", dimmed_text(&format!(">> {text}")));
                            let input = Input::from_str(config, &text, None);
                            ask(config, abort_signal.clone(), input, true).await?;
                        }
                        None => {
                            bail!("Invalid starter value");
                        }
                    }
                }
                None => {
                    let banner = config.read().agent_banner()?;
                    config.read().print_markdown(&banner)?;
                }
            },
            ".save" => match split_first_arg(args) {
                Some(("role", name)) => {
                    config.write().save_role(name)?;
                }
                Some(("session", name)) => {
                    config.write().save_session(name)?;
                }
                _ => {
                    println!(r#"Usage: .save <role|session> [name]"#)
                }

View on GitHub (pinned to 82976d349a)