-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the Bug
Plan Mode Crashes all Variants
To Reproduce
Steps to reproduce the behavior:
Shift Tab in an instance.
Environment
Ubuntu 24.04 LTS
Additional Context
Claude fixed it:
● Bug Report: planModeToolset causes crash when entering plan mode
1
Summary
When planModeToolset or defaultToolset is set in tweakcc config, tweakcc injects code that references setState which is not defined in the scope where the code is injected,
causing a ReferenceError crash when pressing Shift+Tab to enter plan mode. 1
Error
ReferenceError: setState is not defined
at Object.current (file:///.../cli.js:3317:2864)
Injected buggy code
if(JQ==="plan"){setState((prev)=>({...prev,toolset:"minimax"}));}else{setState((prev)=>({...prev,toolset:"minimax"}));}
Affected versions
- tweakcc 3.2.2
- Claude Code 2.1.1
Reproduction
1. Set planModeToolset to any value in tweakcc config
2. Apply tweakcc
3. Launch Claude Code
4. Press Shift+Tab to enter plan mode
5. App crashes with ReferenceError: setState is not defined
Workaround
Remove planModeToolset and defaultToolset from config, restore cli.js from backup, and reapply:
# 1. Edit config to remove the settings
# Remove these lines from tweakcc/config.json:
# "defaultToolset": "...",
# "planModeToolset": "..."
# 2. Set changesApplied to false
sed -i 's/"changesApplied": true/"changesApplied": false/' ~/.cc-mirror/<variant>/tweakcc/config.json
# 3. Restore cli.js from backup
cp ~/.cc-mirror/<variant>/tweakcc/cli.js.backup \
~/.cc-mirror/<variant>/npm/node_modules/@anthropic-ai/claude-code/cli.js
# 4. Reapply tweakcc
TWEAKCC_CONFIG_DIR=~/.cc-mirror/<variant>/tweakcc \
TWEAKCC_CC_INSTALLATION_PATH=~/.cc-mirror/<variant>/npm/node_modules/@anthropic-ai/claude-code/cli.js \
npx tweakcc@3.2.2 --apply
Root cause
The code generator for the toolset feature assumes setState exists in the scope where it injects the mode-switching code, but it doesn't. The injected code appears to be placed
inside a key handler callback where only local variables like JQ, B, G, etc. are available.
It says TweakCC is out of date, once it fixed it, it worked fine.
This impacted both ZAI and MINIMAX variants for me.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working