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
[v2 Regression] Linux system configuration /etc/opencode/opencode.json is not discovered #55373
Version: OpenCode v2.0.26 OS: Ubuntu Linux Previously working version: v1.19.0
OpenCode v2.0.26 fails to automatically discover /etc/opencode/opencode.json, although the same configuration works with v1.19.0.
Plugins
None
OpenCode version
OpenCode v2.0.26
Steps to reproduce
Create a valid provider configuration at /etc/opencode/opencode.json.
Run cd ~ && opencode models.
Observe that the configured provider is missing.
Run cd /etc/opencode && opencode models.
Observe that the configured provider appears.
Symlink /etc/opencode/opencode.json to ~/.config/opencode/opencode.json.
Run cd ~ && opencode models again.
Actual behavior: The configuration is loaded from the current directory or through the user's global configuration path, but not automatically from the Linux system configuration path.
Expected behavior: OpenCode discovers /etc/opencode/opencode.json regardless of the current working directory, as documented.
Additional findings:OPENCODE_CONFIG, OPENCODE_CONFIG_DIR, and OPENCODE_CONFIG_CONTENT did not resolve the problem. A filesystem trace of opencode models did not show access to /etc/opencode.
Thanks for the detailed report and the filesystem trace. I think this is a duplicate of #53074. v2.0.26 and v2.0.27 never look at the system config directory. Support for it was added in #54921 and first shipped in v2.0.28, so upgrading to the latest v2 (opencode upgrade) should make /etc/opencode/opencode.json load no matter which directory you run from.
Possible duplicates and closely related issues, ordered from most to least likely:
One thing to know after upgrading: in v2, ordinary settings in the system config (providers, models and so on) are loaded at the lowest precedence, so they act as machine-wide defaults that user and project config can override. Only experimental.policies in that file outrank everything else.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different, for example if it still happens on v2.0.28 or later.
Thanks for testing on 2.0.28 and 2.0.29. I couldn't reproduce this on 2.0.29. With a provider defined only in /etc/opencode/opencode.json (I tried both the v2 providers format and the v1 provider format), cd ~ && opencode models lists it.
I could, however, get your exact symptom after an upgrade. OpenCode v2 runs a background service, and a service started by 2.0.26 kept running after I upgraded. The 2.0.29 CLI reused it: opencode --version said 2.0.29, but the old service still didn't read /etc/opencode. Restarting the service fixed it:
opencode service restart # or: opencode service stop, then run opencode againcd~&& opencode models
(On my machine service restart printed a "Server process … is still running" error but still replaced the old service. See #54267.)
Could you try that and let us know whether the provider shows up? If it's still missing after a restart, please share:
the output of opencode --version and ps aux | grep '[o]pencode'
your /etc/opencode/opencode.json with secrets removed
the file's permissions (ls -l /etc/opencode/), and whether you run opencode as the same user who can read it
To sum up: support for /etc/opencode was added in v2.0.28 (#54921). After you upgraded, the background service started by 2.0.26 was still running, and the new CLI kept using it, so the system config wasn't read until the service was restarted. If you upgrade OpenCode again, run opencode service restart afterwards so the service matches the new version.
The old service outliving an upgrade is tracked separately, so you can follow it there:
Closing this since you confirmed that restarting the background service fixed it. After the upgrade, a service started by 2.0.26 was still running; that version doesn't read /etc/opencode (support was added in v2.0.28, #54921). After future upgrades, run opencode service restart. The old service outliving an upgrade is tracked in #49664 and #42212. Thanks for the report and for testing. If /etc/opencode isn't picked up again even after a restart, please open a new issue with your version and steps.
Activity
opencode-agent commentedon Oct 14, 2026
Thanks for the detailed report and the filesystem trace. I think this is a duplicate of #53074. v2.0.26 and v2.0.27 never look at the system config directory. Support for it was added in #54921 and first shipped in v2.0.28, so upgrading to the latest v2 (
opencode upgrade) should make/etc/opencode/opencode.jsonload no matter which directory you run from.Possible duplicates and closely related issues, ordered from most to least likely:
/etc/opencodenot respected in v2 (closed, fixed by fix(core): discover system configuration directory at lowest precedence #54921)%ProgramData%\opencode(V1 managed settings) #51107: V2 does not load managed config from%ProgramData%\opencode. Same problem, reported for Windows and also fixed by fix(core): discover system configuration directory at lowest precedence #54921/etc/opencodeon Linux)One thing to know after upgrading: in v2, ordinary settings in the system config (providers, models and so on) are loaded at the lowest precedence, so they act as machine-wide defaults that user and project config can override. Only
experimental.policiesin that file outrank everything else.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different, for example if it still happens on v2.0.28 or later.
pipoe2h commentedon Oct 14, 2026
I've tried with 2.0.28 and 2.0.29, and the issue persists.
opencode-agent commentedon Oct 14, 2026
Thanks for testing on 2.0.28 and 2.0.29. I couldn't reproduce this on 2.0.29. With a provider defined only in
/etc/opencode/opencode.json(I tried both the v2providersformat and the v1providerformat),cd ~ && opencode modelslists it.I could, however, get your exact symptom after an upgrade. OpenCode v2 runs a background service, and a service started by 2.0.26 kept running after I upgraded. The 2.0.29 CLI reused it:
opencode --versionsaid 2.0.29, but the old service still didn't read/etc/opencode. Restarting the service fixed it:(On my machine
service restartprinted a "Server process … is still running" error but still replaced the old service. See #54267.)Could you try that and let us know whether the provider shows up? If it's still missing after a restart, please share:
opencode --versionandps aux | grep '[o]pencode'/etc/opencode/opencode.jsonwith secrets removedls -l /etc/opencode/), and whether you runopencodeas the same user who can read itpipoe2h commentedon Oct 14, 2026
Restarting the service solved the problem.
opencode-agent commentedon Oct 14, 2026
Glad that sorted it, and thanks for confirming!
To sum up: support for
/etc/opencodewas added in v2.0.28 (#54921). After you upgraded, the background service started by 2.0.26 was still running, and the new CLI kept using it, so the system config wasn't read until the service was restarted. If you upgrade OpenCode again, runopencode service restartafterwards so the service matches the new version.The old service outliving an upgrade is tracked separately, so you can follow it there:
Since your problem is solved, the bot will close this issue soon. Reply here if it comes back.
opencode-agent commentedon Oct 17, 2026
Closing this since you confirmed that restarting the background service fixed it. After the upgrade, a service started by 2.0.26 was still running; that version doesn't read
/etc/opencode(support was added in v2.0.28, #54921). After future upgrades, runopencode service restart. The old service outliving an upgrade is tracked in #49664 and #42212. Thanks for the report and for testing. If/etc/opencodeisn't picked up again even after a restart, please open a new issue with your version and steps.