copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

"Rendered more hooks than during the previous render" error occurs

Open YYukiKimura opened this issue 8 months ago • 3 comments

Describe the bug

Summary

A Rendered more hooks than during the previous render error occurs while using GitHub Copilot CLI, causing the current operation to abort.

Version

  • GitHub Copilot CLI: 1.0.6
  • OS: macOS 14.7.6

Steps to Reproduce

  1. Launch the copilot command
  2. Invoke a skill that runs multiple sub-agents in parallel
  3. The error occurs while the skill is running sub-agents

Actual Behavior

The following error is printed and execution stops.

  ERROR  Rendered more hooks than during the previous render.

 file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3898:3104

 - Ma (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3898:3104)
 - E1 (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3898:14278)
 - Object.useMemo (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3988:5480)
 - process.env.NODE_ENV.rl.useMemo (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:2918:12500)
 - pie (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:4641:24035)
 - react-stack-bottom-frame (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3988:12778)
 - gm (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3898:812)
 - w1 (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3905:18055)
 - C1 (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3914:10109)
 - nr (file:///Users/{username}/Library/Caches/copilot/pkg/universal/1.0.6/app.js:3863:112)

Expected Behavior

No error occurs and the operation completes successfully.

Additional Context

  • This error is a violation of React's Rules of Hooks — the number of useMemo calls differs between renders. The stack trace suggests a conditional branch inside the pie component may be causing the hook call count to vary across renders.
  • I tried running with --no-auto-update to pin to v1.0.5, and the parallel sub-agent execution worked without any issues. So the problem appears to be specific to the latest version.

YYukiKimura avatar Mar 17 '26 00:03 YYukiKimura

Reproducible in WSL2 (Ubuntu 24.04) on Windows 11:

 file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3898:3104
 - Ma (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3898:3104)
 - E1 (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3898:14278)
 - Object.useMemo (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3988:5480)
 -process.env.NODE_ENV.rl.useMe (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:2918mo:12500)
 - pie (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:4641:24035)
 -react-stack-bottom-frame (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3988:12778)
 - gm (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3898:812)
 - w1 (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3905:18055)
 - C1 (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3914:10109)
 - nr (file:///home/{username}/.cache/copilot/pkg/universal/1.0.6/app.js:3863:112)

Deleting

~/.local/bin/copilot
~/.cache/copilot

and reinstalling with

curl -fsSL https://gh.io/copilot-install | VERSION="v1.0.5" bash

worked for me.

williamhallatt avatar Mar 17 '26 07:03 williamhallatt

I'm experiencing the same crash described in this issue, consistently occurring when autopilot tasks complete on WSL2.

Environment

  • OS: Ubuntu 24.04.1 LTS (WSL2)
  • Kernel: 6.6.87.2-microsoft-standard-WSL2
  • Terminal: VS Code Integrated Terminal
  • Shell: bash
  • Copilot CLI Version: 1.0.6
  • Node.js: v18.19.1
  • Install Method: Local installation (~/.local/bin/copilot)

Steps to Reproduce

  1. Start Copilot CLI in WSL2 environment
  2. Execute any autopilot task (this occurs consistently regardless of the specific task)
  3. Wait for the autopilot task to complete successfully
  4. Observe immediate crash with React hooks error

Expected Behavior

Copilot CLI should complete the autopilot task and return control to the user without crashing.

Actual Behavior

The application crashes immediately after autopilot task completion with a React hooks violation error.

Error Log

ERROR Rendered more hooks than during the previous render.

file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3898:3104

  • Ma (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3898:3104)
  • E1 (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3898:14278)
  • Object.useMemo (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3988:5480)
  • process.env.NODE_ENV.rl.useMemo (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:2918:12500)
  • pie (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:4641:24035)
  • react-stack-bottom-frame (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3988:12778)
  • gm (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3898:812)
  • w1 (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3905:18055)
  • C1 (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3914:10109)
  • nr (file:///home/suricato/.cache/copilot/pkg/linux-x64/1.0.6/app.js:3863:112)

Workarounds Attempted

  • ✅ Tried different terminal emulators
  • ✅ Restarted WSL2 environment
  • ✅ Updated to latest Copilot CLI version (1.0.6)
  • ❌ Issue persists across all attempts

Additional Context

The crash appears to be 100% reproducible on WSL2 when autopilot tasks complete. The error suggests a React component lifecycle issue where hooks are being called inconsistently between renders, likely triggered by the state transition when autopilot tasks finish.

SuricatoX avatar Mar 17 '26 12:03 SuricatoX

same crash on 1.0.10


 ERROR  Rendered more hooks than during the previous render.

 file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4066:3104

 -el (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4066:310
    4)
 -UW (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4066:142
    78)
 -Object.useMem (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.
               js:4156:5480)
 -process.env.NODE_ENV.Il. (file:///<PATH_TO_APP>/copilot/config/pkg/universal/
  seMemo                  1.0.10/app.js:2318:12500)
 -kie (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4784:25
     857)
 -react-stack-bottom-f (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.
  ame                 10/app.js:4156:12778)
 -Ih
    (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4066:812)

 -SV (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4073:180
    55)
 -aZ (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4082:101
    09)
 -Qe
    (file:///<PATH_TO_APP>/copilot/config/pkg/universal/1.0.10/app.js:4031:112)

rxe2fe avatar Mar 23 '26 14:03 rxe2fe