CommandCodeAI / CommandCodeAI/command-code

Invalid hook call mid-session

未关闭
#539 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@vipulgupta2048 已经在做这个了。

开始于 2026年6月30日。

主要语言
没有语言数据
星标
4k
派生
350
PR 合并指标
30 天内没有已合并 PR

描述

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
  1. Run command-code via bunx
  2. Prompt the LLM to do something
  3. Errors after waiting for some time.
Command Code Version

0.40.14

Operating System

macOS

Terminal/IDE

zed

Shell

zsh

Additional context

No response

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。