{"record":{"id":"9b015bb382b1b159","repo":"tinyhumansai/openhuman","slug":"unknown-mode-other-expected-simple-aggressive","errorCode":null,"errorMessage":"unknown mode '{other}', expected simple|aggressive","messagePattern":"unknown mode '(.+?)', expected simple\\|aggressive","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/core/subconscious_cli.rs","lineNumber":87,"sourceCode":"fn run_tick(args: &[String]) -> Result<()> {\n    let flags = parse_tick_flags(args)?;\n\n    let rt = tokio::runtime::Runtime::new()?;\n    rt.block_on(async {\n        let mut config = crate::openhuman::config::Config::load_or_init()\n            .await\n            .map_err(|e| anyhow!(\"config load failed: {e}\"))?;\n\n        if let Some(ws) = &flags.workspace {\n            config.workspace_dir = ws.clone();\n        }\n\n        if let Some(mode_str) = &flags.mode {\n            config.heartbeat.subconscious_mode = match mode_str.as_str() {\n                \"simple\" => crate::openhuman::config::schema::SubconsciousMode::Simple,\n                \"aggressive\" => crate::openhuman::config::schema::SubconsciousMode::Aggressive,\n                other => {\n                    return Err(anyhow!(\n                        \"unknown mode '{other}', expected simple|aggressive\"\n                    ))\n                }\n            };\n            config.heartbeat.enabled = true;\n            config.heartbeat.inference_enabled = true;\n        }\n\n        // Ensure subconscious is enabled\n        if !config.heartbeat.enabled || !config.heartbeat.inference_enabled {\n            config.heartbeat.enabled = true;\n            config.heartbeat.inference_enabled = true;\n            if !config.heartbeat.subconscious_mode.is_enabled() {\n                config.heartbeat.subconscious_mode =\n                    crate::openhuman::config::schema::SubconsciousMode::Simple;\n            }\n        }\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/core/subconscious_cli.rs#L69-L105","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Use exactly `--mode simple` or `--mode aggressive` (lowercase, no surrounding whitespace).","Run `openhuman subconscious --help` (print_help) to see the accepted commands/flags for the current binary.","If you wanted the subconscious disabled rather than a mode, omit `--mode` entirely and manage `heartbeat.enabled` in config instead.","If scripting, validate the mode against the two-value allowlist before invoking the CLI."],"exampleFix":"# before\nopenhuman subconscious tick --mode Balanced\n# after\nopenhuman subconscious tick --mode aggressive","handlingStrategy":"validation","validationCode":"fn is_valid_subconscious_mode(s: &str) -> bool {\n    matches!(s.trim(), \"simple\" | \"aggressive\")\n}\n\n// before spawning the CLI:\nif let Some(mode) = &opt_mode {\n    assert!(is_valid_subconscious_mode(mode), \"bad --mode: {mode}\");\n}\nCommand::new(bin).args([\"subconscious\", \"tick\", \"--mode\", mode]);","typeGuard":"fn is_valid_subconscious_mode(s: &str) -> bool {\n    matches!(s.trim(), \"simple\" | \"aggressive\")\n}","tryCatchPattern":null,"preventionTips":["Centralize the mode allowlist in one constant shared by scripts and tests.","Run `openhuman subconscious --help` when upgrading — accepted enums can change.","Never pass unvalidated env vars directly as --mode."],"tags":["rust","cli","argument-validation","subconscious","enum-parsing"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}