{"record":{"id":"6ba559dcfcd38db3","repo":"atuinsh/atuin","slug":"agent-does-not-use-json-hooks","errorCode":null,"errorMessage":"agent does not use JSON hooks","messagePattern":"agent does not use JSON hooks","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/atuin/src/command/client/hook.rs","lineNumber":309,"sourceCode":"\n            eprintln!(\n                \"\\nAtuin extension installed for {actor_name}. Extension: {}\\n{reload_hint}\",\n                extension_path.display()\n            );\n        }\n    }\n\n    Ok(())\n}\n\nfn add_hook_entries(hooks: &mut Value, agent: &Agent) -> Result<()> {\n    let InstallKind::JsonHooks {\n        config_path: _,\n        hook_command,\n        matcher,\n    } = agent.install_kind()\n    else {\n        bail!(\"agent does not use JSON hooks\");\n    };\n\n    for event_type in HOOK_EVENT_TYPES {\n        let event_hooks = hooks\n            .as_object_mut()\n            .ok_or_else(|| eyre::eyre!(\"hooks is not a JSON object\"))?\n            .entry(*event_type)\n            .or_insert_with(|| Value::Array(Vec::new()));\n\n        let arr = event_hooks\n            .as_array_mut()\n            .ok_or_else(|| eyre::eyre!(\"hooks.{event_type} is not an array\"))?;\n\n        let already_installed = arr.iter().any(|entry| {\n            entry.get(\"hooks\").and_then(Value::as_array).is_some_and(|hooks| {\n                hooks\n                    .iter()\n                    .any(|hook| hook.get(\"command\").and_then(Value::as_str) == Some(hook_command))","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/atuinsh/atuin/blob/c0c717ab04c881764bcad4b3d169a507e2432643/crates/atuin/src/command/client/hook.rs#L291-L327","documentation":"add_hook_entries edits the agent's JSON hooks configuration and is only valid for agents whose InstallKind is JsonHooks. If called for an agent using a different install kind (e.g. Extension), it bails since there is no JSON hooks structure to mutate.","triggerScenarios":"install() invokes add_hook_entries for an agent whose install_kind() is not InstallKind::JsonHooks; internal dispatch mismatch in the hook installation flow.","commonSituations":"A bug or new agent type added with an install kind not handled by the installer; users cannot normally trigger this directly — it surfaces during `atuin hook install <agent>`.","solutions":["Update atuin to the latest version where the agent's install kind is handled","Report a bug with the agent name if a current release still fails","Verify the agent name is spelled correctly and supported"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match install(&agent) {\n    Err(e) if e.to_string().contains(\"agent does not use JSON hooks\") => {\n        // fall back to the agent's extension-based install path or upgrade atuin\n    }\n    other => other?,\n}","preventionTips":["Keep atuin updated so new agent install kinds are supported","Confirm the agent is a JSON-hooks type before install","Report unsupported agents upstream instead of patching dispatch"],"tags":["hook","internal","agent","configuration"],"backgroundTag":"internal-invariant-violation","analyzedSha":"c0c717ab04c881764bcad4b3d169a507e2432643","analyzedAt":"2026-09-12T07:40:01.341Z","contentChangedAt":"2026-09-12T07:40:01.341Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}