tinyhumansai/openhuman · error · anyhow::Error

unknown mode '{other}', expected simple|aggressive

Error message

unknown mode '{other}', expected simple|aggressive

What it means

Thrown by the `openhuman subconscious` CLI when `--mode <value>` does not match one of the two recognized SubconsciousMode enum strings ("simple" or "aggressive"). The match is exhaustive over user input, so any other string — including typos, casing differences like "Simple", or the TOML enum's other variants — lands in the `other` catch-all arm and aborts before config is saved. It is a pure argument-validation error at src/core/subconscious_cli.rs:87.

Source

Thrown at src/core/subconscious_cli.rs:87

fn run_tick(args: &[String]) -> Result<()> {
    let flags = parse_tick_flags(args)?;

    let rt = tokio::runtime::Runtime::new()?;
    rt.block_on(async {
        let mut config = crate::openhuman::config::Config::load_or_init()
            .await
            .map_err(|e| anyhow!("config load failed: {e}"))?;

        if let Some(ws) = &flags.workspace {
            config.workspace_dir = ws.clone();
        }

        if let Some(mode_str) = &flags.mode {
            config.heartbeat.subconscious_mode = match mode_str.as_str() {
                "simple" => crate::openhuman::config::schema::SubconsciousMode::Simple,
                "aggressive" => crate::openhuman::config::schema::SubconsciousMode::Aggressive,
                other => {
                    return Err(anyhow!(
                        "unknown mode '{other}', expected simple|aggressive"
                    ))
                }
            };
            config.heartbeat.enabled = true;
            config.heartbeat.inference_enabled = true;
        }

        // Ensure subconscious is enabled
        if !config.heartbeat.enabled || !config.heartbeat.inference_enabled {
            config.heartbeat.enabled = true;
            config.heartbeat.inference_enabled = true;
            if !config.heartbeat.subconscious_mode.is_enabled() {
                config.heartbeat.subconscious_mode =
                    crate::openhuman::config::schema::SubconsciousMode::Simple;
            }
        }

View on GitHub (pinned to a221052e0d)

Solutions

  1. Use exactly `--mode simple` or `--mode aggressive` (lowercase, no surrounding whitespace).
  2. Run `openhuman subconscious --help` (print_help) to see the accepted commands/flags for the current binary.
  3. If you wanted the subconscious disabled rather than a mode, omit `--mode` entirely and manage `heartbeat.enabled` in config instead.
  4. If scripting, validate the mode against the two-value allowlist before invoking the CLI.

Example fix

# before
openhuman subconscious tick --mode Balanced
# after
openhuman subconscious tick --mode aggressive
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_subconscious_mode(s: &str) -> bool {
    matches!(s.trim(), "simple" | "aggressive")
}

// before spawning the CLI:
if let Some(mode) = &opt_mode {
    assert!(is_valid_subconscious_mode(mode), "bad --mode: {mode}");
}
Command::new(bin).args(["subconscious", "tick", "--mode", mode]);

Type guard

fn is_valid_subconscious_mode(s: &str) -> bool {
    matches!(s.trim(), "simple" | "aggressive")
}

Prevention

When it happens

Trigger: Running `openhuman subconscious tick --mode balanced`, `--mode SIMPLE` (case-sensitive match), or `--mode aggressive ` (untrimmed whitespace). Also passing a mode name that exists in config TOML (`SubconsciousMode` serde form) but not in this CLI match, e.g. an "off"/"paused" variant.

Common situations: Shell scripts or cron entries that pass a stale mode name after the enum was narrowed; users copying a value from config.toml's heartbeat.subconscious_mode that the CLI does not accept; CI jobs parameterizing --mode from an env var that is empty (empty string hits the `other` arm too).

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/9b015bb382b1b159. Report an issue: GitHub.