{"record":{"id":"d5d32b3bb579a2f1","repo":"zeroclaw-labs/zeroclaw","slug":"unknown-eval-mode-other-expected-replay-or","errorCode":null,"errorMessage":"unknown eval mode '{other}' (expected 'replay' or 'live')","messagePattern":"unknown eval mode '(.+?)' \\(expected 'replay' or 'live'\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-eval/src/lib.rs","lineNumber":36,"sourceCode":"\n/// How an evaluation suite is executed.\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum Mode {\n    /// Deterministic replay against scripted LLM responses — no network, no cost.\n    Replay,\n    /// Live execution against a real provider. Added in a later phase; the Phase 0\n    /// runner returns a clear error so the variant can already be parsed from the CLI.\n    Live,\n}\n\nimpl FromStr for Mode {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        match s.trim().to_ascii_lowercase().as_str() {\n            \"replay\" => Ok(Mode::Replay),\n            \"live\" => Ok(Mode::Live),\n            other => anyhow::bail!(\"unknown eval mode '{other}' (expected 'replay' or 'live')\"),\n        }\n    }\n}\n\nimpl std::fmt::Display for Mode {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.write_str(match self {\n            Mode::Replay => \"replay\",\n            Mode::Live => \"live\",\n        })\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":49,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-eval/src/lib.rs#L18-L49","documentation":"Thrown by `Mode::from_str` in zeroclaw-eval when the mode string, after trim + ASCII lowercase, is neither `replay` nor `live`. The eval harness uses this to parse its `--mode` argument, so any unsupported or misspelled value reaches this error. Matching is deliberately case- and whitespace-insensitive (`Replay` and ` LIVE ` are accepted), so the failure always means the value itself is wrong.","triggerScenarios":"Calling the eval CLI (or `Mode::from_str` directly) with `--mode repaly`, `--mode offline`, `--mode record`, or an empty string. Any value that is not exactly `replay` or `live` after trimming and lowercasing.","commonSituations":"Typos on the command line; assuming a mode exists that was never implemented (only `replay` and `live` parse, and `live` is rejected later by `run_suite` in Phase 0); piping an unset/empty environment variable into the mode argument.","solutions":["Use `--mode replay` — the only mode Phase 0 actually runs (`live` parses but `run_suite` rejects it)","Check the argument for typos, trailing characters, or shell quoting issues","If calling from Rust code, construct `Mode::Replay` directly instead of parsing a string"],"exampleFix":"# before\nzeroclaw-eval --mode repaly ./traces\n# after\nzeroclaw-eval --mode replay ./traces","handlingStrategy":"validation","validationCode":"fn is_known_eval_mode(s: &str) -> bool {\n    matches!(s.trim().to_ascii_lowercase().as_str(), \"replay\" | \"live\")\n}\n\n// before parsing:\nif !is_known_eval_mode(&cli.mode) {\n    eprintln!(\"--mode must be 'replay' or 'live'\");\n    std::process::exit(2);\n}","typeGuard":"fn as_eval_mode(s: &str) -> Option<zeroclaw_eval::Mode> {\n    match s.trim().to_ascii_lowercase().as_str() {\n        \"replay\" => Some(zeroclaw_eval::Mode::Replay),\n        \"live\" => Some(zeroclaw_eval::Mode::Live),\n        _ => None,\n    }\n}","tryCatchPattern":"let mode = match zeroclaw_eval::Mode::from_str(&cli.mode) {\n    Ok(m) => m,\n    Err(e) => {\n        eprintln!(\"invalid --mode: {e}\");\n        print_usage();\n        return;\n    }\n};","preventionTips":["Whitelist the --mode value in your CLI layer and reject unknown values with usage text before it reaches from_str","Normalize input (trim + lowercase) the same way from_str does before validating","Remember 'live' parses but is rejected by run_suite in Phase 0 — validate against the actually-supported set, not the parseable set"],"tags":["eval","cli","argument-parsing","zeroclaw-eval"],"backgroundTag":"invalid-enum-value","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}