{"record":{"id":"3a6fb85053b6f11b","repo":"sigoden/aichat","slug":"unknown-command-type-help-for-additional-help","errorCode":null,"errorMessage":"Unknown command. Type \".help\" for additional help.","messagePattern":"Unknown command\\. Type \"\\.help\" for additional help\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/repl/mod.rs","lineNumber":762,"sourceCode":"        .write()\n        .after_chat_completion(&input, &output, &tool_results)?;\n    if !tool_results.is_empty() {\n        ask(\n            config,\n            abort_signal,\n            input.merge_tool_results(output, tool_results),\n            false,\n        )\n        .await\n    } else {\n        Config::maybe_autoname_session(config.clone());\n        Config::maybe_compress_session(config.clone());\n        Ok(())\n    }\n}\n\nfn unknown_command() -> Result<()> {\n    bail!(r#\"Unknown command. Type \".help\" for additional help.\"#);\n}\n\nfn dump_repl_help() {\n    let head = REPL_COMMANDS\n        .iter()\n        .map(|cmd| format!(\"{:<24} {}\", cmd.name, cmd.description))\n        .collect::<Vec<String>>()\n        .join(\"\\n\");\n    println!(\n        r###\"{head}\n\nType ::: to start multi-line editing, type ::: to finish it.\nPress Ctrl+O to open an editor for editing the input buffer.\nPress Ctrl+C to cancel the response, Ctrl+D to exit the REPL.\"###,\n    );\n}\n\nfn parse_command(line: &str) -> Option<(&str, Option<&str>)> {","sourceCodeStart":744,"sourceCodeEnd":780,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/repl/mod.rs#L744-L780","documentation":"`unknown_command()` is the catch-all handler for REPL commands that do not match any known command (including renamed/deprecated ones). It bails with a message directing the user to `.help` for the list of valid commands.","triggerScenarios":"Typing any dot-command that is not in REPL_COMMANDS and not handled by an arm of the match in run_repl_command — e.g. misspellings like `.clr` or `.conitnue`, or commands removed in newer versions.","commonSituations":"Typos in command names; using commands from other CLI tools; referencing removed/renamed commands like .clear messages (which has its own message, but .clear alone hits this); copy-pasted command lists from outdated docs.","solutions":["Run .help to list valid commands and correct the command name","Check for renamed commands (e.g. .empty session replaced .clear messages)","If the input was meant to be a chat message, do not prefix it with '.'"],"exampleFix":"// before: typo command\n.conitnue\n// after\n.continue","handlingStrategy":"validation","validationCode":"const KNOWN: &[&str] = &[\".help\",\".model\",\".agent\",\".starter\",\".edit\",\".continue\",\".regenerate\",\".copy\",\".empty\",\".save\",\".exit\",\".source\",\".last\"];\nfn is_known(cmd: &str) -> bool {\n    let name = cmd.split_whitespace().next().unwrap_or(\"\");\n    KNOWN.contains(&name)\n}","typeGuard":"fn is_dot_command(input: &str) -> bool {\n    input.starts_with('.') && input.len() > 1\n}","tryCatchPattern":"match repl(cmd) {\n    Err(e) if e.to_string().contains(\"Unknown command\") => {\n        eprintln!(\"{} is not a command; run .help\", cmd);\n    }\n    other => other?,\n}","preventionTips":["Verify command names with .help before use","Don't prefix plain chat messages with '.'","Re-check macros for commands removed or renamed in newer versions"],"tags":["repl","cli","command-not-found"],"backgroundTag":"command-not-found","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}