Sunday, February 15, 2026

Qwen Code CLI sandbox bug

If you are running `qwen -s` or `qwen --sandbox` and everytime you need to reauthenticate, There is a bug in qwen-code:0.10.1 docker image.

The CLI tool mount host `~/.qwen` directory to the container /home/node/.qwen directory: See https://github.com/QwenLM/qwen-code/blob/9adad2f369bbeea7e7295614f3e3e5342d20ce5a/packages/cli/src/utils/sandbox.ts#L433

But there is a recent commit which removed `User node` from the docker image. See: https://github.com/QwenLM/qwen-code/commit/5c949136432e91a90d2b565116d73fe498fcc262#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557L40

Work around 1 - Rebuild Docker and get it back to run with user node

check out the qwen-code project, update the Dockerfile, revert some of the change of the commit back and then `npm run build:sandbox`.

Work around 2 - Hack installed qwen-code script in node_modules

Find the `cli.js` in the node_modules installation. Find the line `/home/node/${SETTINGS_DIRECTORY_NAME}` and change it to `/root/${SETTINGS_DIRECTORY_NAME}`. 

Work around 3 - Rebuild Docker and symlink /root/.qwen with /home/node/.qwen

checkout out the qwen-code project, update the Dockerfile to symlink /root/.qwen to /home/node/.qwen like this


Both workaround 2 & 3 worked for me. 

Workaround 1 is "better", as it adheres to the rule of giving least/minimum access to the execution user, but it is slightly more complicated to get right and I couldn't quite get it to work yet.

No comments:

Post a Comment