Skip to content

[v2 Regression] Linux system configuration /etc/opencode/opencode.json is not discovered #55373

Closed as not planned

Description

@pipoe2h

Description

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

  1. Create a valid provider configuration at /etc/opencode/opencode.json.
  2. Run cd ~ && opencode models.
  3. Observe that the configured provider is missing.
  4. Run cd /etc/opencode && opencode models.
  5. Observe that the configured provider appears.
  6. Symlink /etc/opencode/opencode.json to ~/.config/opencode/opencode.json.
  7. 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.

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

Linux terminal (bash)

Activity

  1. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    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.

  2. pipoe2h commented on Oct 14, 2026

    @pipoe2h
    Author

    I've tried with 2.0.28 and 2.0.29, and the issue persists.

  3. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    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 again
    cd ~ && 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
  4. pipoe2h commented on Oct 14, 2026

    @pipoe2h
    Author

    Restarting the service solved the problem.

  5. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Glad that sorted it, and thanks for confirming!

    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:

    Since your problem is solved, the bot will close this issue soon. Reply here if it comes back.

  6. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions