You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI: crash on startup when ~/.config/opencode directory mounted RO #56359
Starting with opencode v2 a config directory being read-only (for consistency reasons, or in sandboxes) opencode crashes with
$ opencode
Starting background server...
Error: Server process exited with code 1
PlatformError: Unknown: FileSystem.writeFile (/home/user/.config/opencode/service.json.tmp)
at jl (/$bunfs/root/chunk-47jzpmgp.js:2:956)
at <anonymous> (/$bunfs/root/chunk-xx0kd2h3.js:2:7308)
at guarded (internal:shared:112:26)
at processTicksAndRejections (unknown:7:39) {
[cause]: Error: EROFS: read-only file system, open '/home/user/.config/opencode/service.json.tmp'
}
at map (native:1:11)
at reap (/$bunfs/root/chunk-mtkfx0g6.js:2:1203)
at <anonymous> (/$bunfs/root/chunk-mtkfx0g6.js:3:6711)
at service.ensure (/$bunfs/root/chunk-bsm4erxq.js:3:690)
at service.ensure (definition) (/$bunfs/root/chunk-mtkfx0g6.js:3:5523)
at cli.server-connection.resolve (/$bunfs/root/chunk-ex8cqpvg.js:96:6563)
at cli.server-connection.resolve (definition) (/$bunfs/root/chunk-bsm4erxq.js:2:402)
Plugins
No response
OpenCode version
opencode v2.0.32
Steps to reproduce
enter a podman/docker container with the hosts config directory being mounted, e.g. --volume" "${HOME}/.config/opencode:${HOME}/.config/opencode/:ro,z
Thanks for the clear report. I could reproduce this on v2.0.32. With an empty ~/.config/opencode bind-mounted read-only, opencode run hello fails with Server process exited with code 1 and the same EROFS ... service.json.tmp error you posted. On the latest dev (22e771f), the background server (opencode serve --service) still fails the same way when run directly.
The cause appears to be that the background server always tries to save a generated password into service.json in the config directory if there isn't one yet.
Workaround (confirmed on 2.0.32): put a service.json with a password in the host config directory before mounting it read-only, e.g.
{ "password": "<some long random string>" }
With that file in place, opencode starts normally with the read-only mount.
The script below reproduces the crash (it needs root for the read-only bind mount).
Reproduction script (repro.sh)
#!/usr/bin/env bash# Reproduce: opencode crashes on startup when ~/.config/opencode is read-only.# Needs root (for a read-only bind mount). Set OPENCODE_CMD to override the command.set -u
CMD=${OPENCODE_CMD:-opencode}
H=$(mktemp -d /tmp/opencode/home.XXXX)
mkdir -p "$H/.config/opencode""$H/project"
mount --bind "$H/.config/opencode""$H/.config/opencode"
mount -o remount,bind,ro "$H/.config/opencode"
touch "$H/.config/opencode/probe"2>&1| sed 's/^/check: /'cd"$H/project"# `opencode run` resolves the background service the same way the TUI does.
HOME="$H" XDG_CONFIG_HOME= XDG_STATE_HOME= XDG_DATA_HOME= XDG_CACHE_HOME= \
timeout 60 $CMD run "hello"2>&1| head -40
echo"exit: ${PIPESTATUS[0]}"
umount "$H/.config/opencode"
I've opened PR [#56539](#56539) to address this issue.
The fix allows the local service to start when the configuration directory is read-only, while preserving the expected behavior when remote configuration requires password persistence. I've also added regression test coverage for this scenario.
Activity
opencode-agent commentedon Oct 17, 2026
Thanks for the clear report. I could reproduce this on v2.0.32. With an empty
~/.config/opencodebind-mounted read-only,opencode run hellofails withServer process exited with code 1and the sameEROFS ... service.json.tmperror you posted. On the latestdev(22e771f), the background server (opencode serve --service) still fails the same way when run directly.The cause appears to be that the background server always tries to save a generated password into
service.jsonin the config directory if there isn't one yet.Workaround (confirmed on 2.0.32): put a
service.jsonwith a password in the host config directory before mounting it read-only, e.g.{ "password": "<some long random string>" }With that file in place, opencode starts normally with the read-only mount.
The script below reproduces the crash (it needs root for the read-only bind mount).
Reproduction script (repro.sh)
Run it:
bash repro.shharshitsharmaaaa commentedon Oct 22, 2026
I've opened PR [#56539](#56539) to address this issue.
The fix allows the local service to start when the configuration directory is read-only, while preserving the expected behavior when remote configuration requires password persistence. I've also added regression test coverage for this scenario.
Feedback and review are welcome!