Skip to content

Code agent can't write due to sandbox-mode #348

@tsly123

Description

@tsly123

What version of Code is running?

code 0.2.188

Which model were you using?

gpt-5-codex

What platform is your computer?

Linux 5.14.0-570.19.1.el9_6.x86_64 x86_64 x86_64

What steps can reproduce the bug?

Code agent can't create/write due to sandbox-mode. Clause can create/edit/remove files

I've tried:

  • start new session with code
  • start new session with code --sandbox workspace-write --ask-for-approval on-request
  • start new session with code --full-auto
  • start new session with code -- --write

Everytime I started a new session, I removed the config.toml for a fresh start.

I've also tried npm install -g @just-every/code@latest then started all the options above.

I've tried the example config


How I know Code can't create/write? Everytime I started a new session:

/code "write a single "hello_world" python file to verify the read/write permissions for this repo, and also verify the collaboration between 2 agents. Do not do anything else" or
/code "please verify the read/write permissions for this repo, and whether Code and Claude will be able to modify the repo during /code runs? Do not do anything else"

What is the expected behavior?

Code (and Claude) can create/edit/remove file

What do you see instead?

Below is one of the responses. It's different from time to time, like write permission denied, or many sandbox mode, or recurring --sandbox <SANDBOX_MODE> as below. But it's always something relevant to sandbox

I couldn’t confirm edits from either backend on this run:                                                                                
                                                                                                                                            
   - Claude agent returned an empty result.txt, so it didn’t report (or possibly didn’t complete) the write/read/delete steps—no temp files  were left behind, and there’s no log of the attempt.                                                                                     
   - Code agent exited immediately with the recurring --sandbox <SANDBOX_MODE> cannot be used multiple times launcher error before it could touch the workspace (.code/agents/bdcb78bb-6437-4cc0-9247-d751b954454f/error.txt).                                                       
                                                                                                                                            
   No repo files were modified during this attempt. If you’d like, I can retry after adjusting the Claude task instructions to log its  steps explicitly, or we can debug the Code launcher flag issue so it can run. 

In addition, sometime, I ask to verify the write permission. The first pass was okay, either Code and Claude write on different worktree or just write permission confirmed. However, in the same session and changing nothing, I asked to verify the write permission again in the next question. It's permission denied.

Additional information

I don't whether this is bug or I did something wrong. But I kept seeing this for over 30 sessions now and can't do anything with it.

In addition, in the very first time when I first download and run code. It worked normally, create/edit/remove code without any problem.

What should I do here?

Thank you.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions