Answer: To debug Gemini CLI hooks, follow the "Strict JSON" rule: send only JSON to stdout and redirect logs and text to stderr, and log to dedicated files since hooks run in the background. Status: Confirmed Entry: tool/gemini-cli/troubleshooting/debug-hooks Revision: 1 Digest: sha256:7e2334da18ba40df (changes whenever the content changes) Timeline: Created: 2026-11-13T03:18:33Z Last changed: 2026-11-13T03:18:33Z Last verified: 2026-11-20T12:53:02Z Next check: 2026-11-21T12:53:02Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of stdout rule | JSON only | [1] | 2026-11-20 stderr rule | logs and text | [1] | 2026-11-20 logging recommendation | writing to a dedicated log file | [1] | 2026-11-20 example log file | .gemini/hooks/debug.log | [1] | 2026-11-20 Sources: [1] Google. "Hooks Best Practices". https://geminicli.com/docs/hooks/best-practices.md Role: primary. Accessed: 2026-11-20T12:53:02Z Quote: "**stdout** is for **JSON only**." (Supports: stdout rule) Quote: "**stderr** is for **logs and text**." (Supports: stderr rule) Quote: "writing to a dedicated log file is often the easiest way to debug complex logic." (Supports: logging recommendation) Quote: "LOG_FILE=".gemini/hooks/debug.log"" (Supports: example log file) Published: 2026-10-16T02:36:07Z Snapshot SHA-256: fb44fbcfaccc3cdb7895d989f3808bed66cfa6516411535c4c4d9077d242e7bc (captured 2026-11-13T03:18:32Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-13T03:18:33Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:53:02Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:53:02Z Last attempt: 2026-11-20T12:53:02Z Notes and limitations: Extracted automatically from a single official source (section "Debugging"). Related: https://latestn.com/tool/gemini-cli/troubleshooting/debugging-tips How can I debug issues with Gemini CLI? https://latestn.com/tool/gemini-cli/troubleshooting/exit-codes-meaning What do the exit codes mean in Gemini CLI? https://latestn.com/tool/gemini-cli/troubleshooting/extension-not-loading How do I troubleshoot a Gemini CLI extension that is not loading? https://latestn.com/tool/gemini-cli/settings/skill-discovery-tiers What are the discovery tiers and precedence for Gemini CLI Agent Skills? https://latestn.com/tool/gemini-cli/settings/update-extension How do I update a Gemini CLI extension to pull changes from its source? https://latestn.com/tool/gemini-cli/troubleshooting/acp-debugging-telemetry How can I debug Gemini CLI ACP mode and enable telemetry? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-13T03:18:33Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/gemini-cli/troubleshooting/debug-hooks/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/gemini-cli/troubleshooting/debug-hooks POST: https://latestn.com/dispute/tool/gemini-cli/troubleshooting/debug-hooks with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/gemini-cli/troubleshooting/debug-hooks?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I debug Gemini CLI hooks that aren't working? Revision 1, last verified 2026-11-20T12:53:02Z. https://latestn.com/tool/gemini-cli/troubleshooting/debug-hooks (accessed 2026-11-21T09:53:01Z). @misc{LatestN_tool_gemini_cli_troubleshooting_debug_hooks_r1, title = {How do I debug Gemini CLI hooks that aren't working?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/gemini-cli/troubleshooting/debug-hooks}}, note = {Revision 1; digest sha256:7e2334da18ba40df; last verified 2026-11-20T12:53:02Z; accessed 2026-11-21T09:53:01Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/gemini-cli/troubleshooting/debug-hooks