Answer: Use the onErrorOccurred hook, which is called when errors occur during session execution. Status: Confirmed Entry: tool/github-copilot/troubleshooting/error-handling-hook Revision: 2 Digest: sha256:13c934b2570aecae (changes whenever the content changes) Timeline: Created: 2026-11-13T03:28:26Z Last changed: 2026-11-18T13:04:03Z (when called: when errors occur during session execution → —) Last verified: 2026-11-20T13:08:51Z Next check: 2026-11-21T13:08:51Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of hook name | onErrorOccurred | [1] | 2026-11-20 Sources: [1] GitHub. "Use hooks - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-sdk/hooks Role: primary. Accessed: 2026-11-20T13:08:51Z Quote: "The onErrorOccurred hook is called when errors occur during session execution." (Supports: hook name) Snapshot SHA-256: 131dd66560e7d332ef9117d742e8ee0360c7ad986710f2f3a3f5ba1369511806 (captured 2026-11-18T13:04:00Z) 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-18T13:04:03Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:08:51Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:08:51Z Last attempt: 2026-11-20T13:08:51Z Notes and limitations: Extracted automatically from a single official source (section "Error handling hook"). Related: https://latestn.com/tool/github-copilot/troubleshooting/firewall-block-cause What causes GitHub Copilot to be blocked by a firewall or proxy? https://latestn.com/tool/github-copilot/troubleshooting/fix-access-denied How do I fix an "Access denied" error in GitHub Copilot CLI? https://latestn.com/tool/github-copilot/troubleshooting/fix-authentication-vscode How do I fix GitHub Copilot authentication problems in Visual Studio Code? https://latestn.com/tool/github-copilot/troubleshooting/enable-debug-logging How do I enable debug logging in the GitHub Copilot SDK? https://latestn.com/tool/github-copilot/troubleshooting/enable-debug-mode How do I enable debug mode for GitHub Copilot in my IDE? https://latestn.com/tool/github-copilot/troubleshooting/enable-mcp-debug-logging How do I enable MCP debug logging in GitHub Copilot? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T13:04:03Z | changed | when called: when errors occur during session execution → — | [1] 2026-11-13T03:28:26Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/troubleshooting/error-handling-hook/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/github-copilot/troubleshooting/error-handling-hook POST: https://latestn.com/dispute/tool/github-copilot/troubleshooting/error-handling-hook with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/troubleshooting/error-handling-hook?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I handle errors with a hook in the GitHub Copilot SDK? Revision 2, last verified 2026-11-20T13:08:51Z. https://latestn.com/tool/github-copilot/troubleshooting/error-handling-hook (accessed 2026-11-21T09:53:05Z). @misc{LatestN_tool_github_copilot_troubleshooting_error_handling_hook_r2, title = {How do I handle errors with a hook in the GitHub Copilot SDK?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/troubleshooting/error-handling-hook}}, note = {Revision 2; digest sha256:13c934b2570aecae; last verified 2026-11-20T13:08:51Z; accessed 2026-11-21T09:53:05Z} } 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/github-copilot/troubleshooting/error-handling-hook