CommandCodeAI / CommandCodeAI/command-code
Invalid hook call mid-session
Open
@vipulgupta2048 is already working on this.
Since Jun 30, 2026.
- Dominant language
- No language data
- Stars
- 4k
- Forks
- 350
- PR merge metrics
- No merged PRs in 30d
Description
Summary
Command Code (ran via bunx command-code raises "ERROR Cannot read properties of null (reading 'useState')" mid-session all the time. Whether it's reasoning, calling tools or anything else.
Expected Behavior
The session should go on properly.
Actual Behavior
Stack trace:
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.
ERROR Cannot read properties of null (reading 'useState')
/Users/harrow/.bun/install/global/node_modules/react/cjs/react.development.js:1221:33
1218: return resolveDispatcher().useRef(initialValue);
1219: };
1220: exports.useState = function (initialState) {
1221: return resolveDispatcher().useState(initialState);
1222: };
1223: exports.useSyncExternalStore = function (
1224: subscribe,
-process.env.NODE_ENV.exports.useS (/Users/harrow/.bun/install/global/node_modules/react/cjs/react.development.
ate js:1221:33)
-SelectInput
(file:///Users/harrow/.bun/install/global/node_modules/ink-select-input/build/SelectInput.js:11:43)
-Object.react_stack_botto (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_mo
_frame dules/react-reconciler/cjs/react-reconciler.development.js:17596:20)
-renderWithHoo (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react
s -reconciler/cjs/react-reconciler.development.js:5335:22)
-updateFunctionCompo (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules
ent /react-reconciler/cjs/react-reconciler.development.js:7720:19)
-beginWork (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-rec
onciler/cjs/react-reconciler.development.js:9277:18)
-runWithFiberInD (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/rea
V ct-reconciler/cjs/react-reconciler.development.js:2505:30)
-performUnitOfWo (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/rea
k ct-reconciler/cjs/react-reconciler.development.js:15273:22)
-workLoopSyn (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-r
econciler/cjs/react-reconciler.development.js:15099:41)
-renderRootSy (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-
c reconciler/cjs/react-reconciler.development.js:15080:11)
✖ CRITICAL: Unhandled Promise Rejection!
This is an unexpected error. Please file a bug report at https://github.com/CommandCodeAI/command-code/issues/new
✖ ERROR → TypeError
ℹ REASON → Cannot read properties of null (reading 'useState')
ℹ ERROR STACK ↓
TypeError: Cannot read properties of null (reading 'useState')
at process.env.NODE_ENV.exports.useState (/Users/harrow/.bun/install/global/node_modules/react/cjs/react.development.js:1221:33)
at SelectInput (file:///Users/harrow/.bun/install/global/node_modules/ink-select-input/build/SelectInput.js:11:43)
at Object.react_stack_bottom_frame (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:17596:20)
at renderWithHooks (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:5335:22)
at updateFunctionComponent (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:7720:19)
at beginWork (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:9277:18)
at runWithFiberInDEV (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:2505:30)
at performUnitOfWork (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:15273:22)
at workLoopSync (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:15099:41)
at renderRootSync (/Users/harrow/.bun/install/global/node_modules/command-code/node_modules/ink/node_modules/react-reconciler/cjs/react-reconciler.development.js:15080:11)
ℹ Trace ID: d82d586c31909e4ba87bec83b7278a5d
Share this ID with support to help debug your issue.
Steps to reproduce the issue
- Run command-code via
bunx - Prompt the LLM to do something
- Errors after waiting for some time.
Command Code Version
0.40.14
Operating System
macOS
Terminal/IDE
zed
Shell
zsh
Additional context
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.