{"record":{"id":"4b1f01d9a6592385","repo":"atuinsh/atuin","slug":"expected-atuin-hook-agent-or-atuin-hook-install-agent","errorCode":null,"errorMessage":"expected `atuin hook <agent>` or `atuin hook install <agent>`","messagePattern":"expected `atuin hook <agent>` or `atuin hook install <agent>`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/hook.rs","lineNumber":167,"sourceCode":"#[derive(Parser, Debug)]\n#[command(infer_subcommands = true, args_conflicts_with_subcommands = true)]\npub struct Cmd {\n    #[command(subcommand)]\n    action: Option<Action>,\n\n    /// Which agent's hook format to parse (e.g., \"claude-code\")\n    #[arg(value_name = \"AGENT\", hide = true)]\n    agent: Option<String>,\n}\n\nimpl Cmd {\n    #[instrument(level = \"trace\", skip_all, err)]\n    pub async fn run(self, settings: &Settings) -> Result<()> {\n        match (self.action, self.agent) {\n            (Some(Action::Install { agent }), None) => install(&agent),\n            (None, Some(agent)) => handle(&agent, settings).await,\n            (None, None) => {\n                bail!(\"expected `atuin hook <agent>` or `atuin hook install <agent>`\");\n            }\n            (Some(_), Some(_)) => {\n                bail!(\"hook action cannot be combined with a positional agent\");\n            }\n        }\n    }\n}\n\nfn id_file_path(tool_use_id: &str) -> PathBuf {\n    std::env::temp_dir().join(format!(\"atuin-hook-{tool_use_id}\"))\n}\n\nasync fn handle(agent_name: &str, settings: &Settings) -> Result<()> {\n    let agent = Agent::from_name(agent_name)?;\n\n    if let InstallKind::Extension { reload_hint, .. } = agent.install_kind() {\n        bail!(\n            \"`atuin hook {agent_name}` is not supported. Use `atuin hook install {agent_name}`. \\","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/hook.rs#L149-L185","documentation":"`atuin hook` supports two forms: an action (`install <agent>`) or a bare agent name to emit hook output for that agent. Invoking it with neither fails immediately with usage guidance. It is a CLI argument validation error, not a runtime failure.","triggerScenarios":"Running `atuin hook` with no subcommand and no positional agent argument.","commonSituations":"Typos such as running `atuin hook` alone; scripting the command without arguments; misunderstanding the two invocation forms.","solutions":["Pass the agent: `atuin hook <agent>` (e.g. atuin hook claude)","Or install hooks: `atuin hook install <agent>`","Run `atuin hook --help` to see valid forms"],"exampleFix":"// before\natuin hook\n// after\natuin hook claude","handlingStrategy":"validation","validationCode":"# guard in scripts\n[ -n \"$AGENT\" ] || { echo \"usage: atuin hook <agent> | atuin hook install <agent>\"; exit 2; }\natuin hook \"$AGENT\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an agent name or an install action","Read `atuin hook --help` before scripting","Validate argument count in wrapper scripts"],"tags":["cli","usage","arguments","hook"],"backgroundTag":"missing-cli-argument","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}