No opencode.json file #2787

Open
opened 2026-02-16 17:37:15 -05:00 by yindo · 13 comments
Owner

Originally created by @agarzon on GitHub (Nov 11, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

I've installed opencode in mac and linux WSL... and I'm unable to find the file opencode.json is not in ~/.config/opencode/ where it supposed to be according the documentation, in fact is nowhere in the hard drive.

However, it remembers my theme selection, so that is saved somewhere... but where?

OpenCode version

1.0.55

Steps to reproduce

  • Install opencode (brew or npm)
  • Try to find the opencode.json file

Screenshot and/or share link

Image

Operating System

macOS, Debian 12 and Windows 11

Terminal

terminal (mac), windows terminal (wsl)

Originally created by @agarzon on GitHub (Nov 11, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description I've installed opencode in mac and linux WSL... and I'm unable to find the file `opencode.json` is not in `~/.config/opencode/` where it supposed to be according the documentation, in fact is nowhere in the hard drive. However, it remembers my theme selection, so that is saved somewhere... but where? ### OpenCode version 1.0.55 ### Steps to reproduce - Install opencode (brew or npm) - Try to find the opencode.json file ### Screenshot and/or share link <img width="655" height="197" alt="Image" src="https://github.com/user-attachments/assets/2e4f5ec4-f2f4-42a2-8bb2-9f10965ac6be" /> ### Operating System macOS, Debian 12 and Windows 11 ### Terminal terminal (mac), windows terminal (wsl)
yindo added the documentation label 2026-02-16 17:37:15 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 11, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3407: Similar confusion about opencode.json/config.json search paths and file locations
  • #4194: PATCH /config uses wrong config file - related to config file path issues
  • #4170: Documentation issue about reorganizing config directories

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 11, 2025): This issue might be a duplicate of existing issues. Please check: - #3407: Similar confusion about opencode.json/config.json search paths and file locations - #4194: PATCH /config uses wrong config file - related to config file path issues - #4170: Documentation issue about reorganizing config directories Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

@agarzon the opencode.json needs to be created by u the user, the state of the tui is saved in ~/.local/state/opencode

for theme thats in ~/.local/state/opencode/kv.json

@rekram1-node commented on GitHub (Nov 11, 2025): @agarzon the `opencode.json` needs to be created by u the user, the state of the tui is saved in ~/.local/state/opencode for theme thats in ~/.local/state/opencode/kv.json
Author
Owner

@agarzon commented on GitHub (Nov 11, 2025):

I see, the documentation then is quite confusing.

@agarzon commented on GitHub (Nov 11, 2025): I see, the documentation then is quite confusing.
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

@agarzon do we need to make it more clear here that by "Place your config" we mean create it?

https://opencode.ai/docs/config/#global

Which part confused you so we can update

@rekram1-node commented on GitHub (Nov 11, 2025): @agarzon do we need to make it more clear here that by "Place your config" we mean create it? https://opencode.ai/docs/config/#global Which part confused you so we can update
Author
Owner

@agarzon commented on GitHub (Nov 11, 2025):

The ~/.local/state/opencode for instance, it is not mentioned in the documentation.

@agarzon commented on GitHub (Nov 11, 2025): The `~/.local/state/opencode` for instance, it is not mentioned in the documentation.
Author
Owner

@rekram1-node commented on GitHub (Nov 11, 2025):

@agarzon well thats not a file you should be editing but we can document the various paths thats fair

@rekram1-node commented on GitHub (Nov 11, 2025): @agarzon well thats not a file you should be editing but we can document the various paths thats fair
Author
Owner

@nirvdrum commented on GitHub (Jan 11, 2026):

For what it's worth, I got caught up by this as well. I'm a bit more accustomed to apps writing back to their configuration file. Typically, they dump out a file with default values and then change values as configured in the GUI/TUI. I'm trying to consistently set up my development environment with Home Manager, so I thought the simplest thing would be to configure OpenCode from within the program and then extract the configuration over to my Home Manager config. In general, I find this approach a lot easier to follow when getting started than trying to compose a config file from a bunch of documentation snippets in an application I've never successfully configured before.

In any event, I spent a fair bit of time trying to figure out where everything was. The docs and, consequently, search engines indicated config would be in a place that it ultimately wasn't being written to. Without a doubt, I assumed the configuration file would be updated and that's not guaranteed behavior, but the assumption was based on how other tools typically work. I was about to dig into the source, but I ultimately worked it out by changing the theme and then grepping on the theme value until I discovered ~/.local/state/opencode.

Maybe an opencode /init_config would be interesting? That way OpenCode wouldn't have to write back to config.json but

@nirvdrum commented on GitHub (Jan 11, 2026): For what it's worth, I got caught up by this as well. I'm a bit more accustomed to apps writing back to their configuration file. Typically, they dump out a file with default values and then change values as configured in the GUI/TUI. I'm trying to consistently set up my development environment with Home Manager, so I thought the simplest thing would be to configure OpenCode from within the program and then extract the configuration over to my Home Manager config. In general, I find this approach a lot easier to follow when getting started than trying to compose a config file from a bunch of documentation snippets in an application I've never successfully configured before. In any event, I spent a fair bit of time trying to figure out where everything was. The docs and, consequently, search engines indicated config would be in a place that it ultimately wasn't being written to. Without a doubt, I assumed the configuration file would be updated and that's not guaranteed behavior, but the assumption was based on how other tools typically work. I was about to dig into the source, but I ultimately worked it out by changing the theme and then grepping on the theme value until I discovered _~/.local/state/opencode_. Maybe an `opencode /init_config` would be interesting? That way OpenCode wouldn't have to write back to _config.json_ but
Author
Owner

@carrot-codeing commented on GitHub (Jan 12, 2026):

same confusion, the docs says a lot about opencode.json, but never guide how to start from the first time.

@carrot-codeing commented on GitHub (Jan 12, 2026): same confusion, the docs says a lot about opencode.json, but never guide how to start from the first time.
Author
Owner

@mello29 commented on GitHub (Jan 23, 2026):

Same here.

I'm consolidating various dotfiles and similar settings.json files into a single repository, managed by chezmoi.
I was expecting that changing to/setting a specific model via TUI would write that to ~/.config/opencode.json so I could just lift it from there, but it obviously doesn't — when that would be the expected behaviour based on both the official documentation and past experience with other tools.

It makes it quite difficult to get a proper understanding of the specific syntax to be used in the settings file.
For example, what's the correct syntax to add to opencode.json to get OpenCode to use "Claude Opus 4.5 (latest)" (as shown on the TUI)? Should it be claude-opus-4-5 or claude-opus-4-5-latest? Or maybe something else?

Just "dumping" the configuration from the TUI back into opencode.json (or, in general, OPENCODE_CONFIG) would be a great improvement.

@mello29 commented on GitHub (Jan 23, 2026): Same here. I'm consolidating various dotfiles and similar `settings.json` files into a single repository, managed by chezmoi. I was expecting that changing to/setting a specific model via TUI would write that to `~/.config/opencode.json` so I could just lift it from there, but it obviously doesn't — when that would be the expected behaviour based on both the official documentation and past experience with other tools. It makes it quite difficult to get a proper understanding of the specific syntax to be used in the settings file. For example, what's the correct syntax to add to `opencode.json` to get OpenCode to use "Claude Opus 4.5 (latest)" (as shown on the TUI)? Should it be `claude-opus-4-5` or `claude-opus-4-5-latest`? Or maybe something else? Just "dumping" the configuration from the TUI back into `opencode.json` (or, in general, `OPENCODE_CONFIG`) would be a great improvement.
Author
Owner

@sebthom commented on GitHub (Feb 1, 2026):

Coming from codex I have to say the config seems to be a bit of a mess. I am on Windows and in my home directory after starting opencode once, I now have:

C:\Users\<USER>\
  -> .config\opencode\
      -> node_modules\
      -> package.json
      -> bun.lock
      -> .gitignore
  -> .local
      -> state\opencode\
           -> kv.json
      -> share\opencode\
           -> log
           -> storage
           -> bin
           -> auth.json
  • Why would opencode create all these files under .config\opencode\ if it has its "internal" state dir at .local\state.
  • When I create an opencode.jsonc file under C:\Users<USER>.config\opencode\opencode.jsonc file it does not get picked up.
  • The opencode UI does not show which files it effectively is loading from where. And by reading the documentation it is not clear where opencode "magically" stores the model authentications or any settings interactively applied via the UI like changing the theme.

All this leaves one very puzzled.

@sebthom commented on GitHub (Feb 1, 2026): Coming from codex I have to say the config seems to be a bit of a mess. I am on Windows and in my home directory after starting opencode once, I now have: ``` C:\Users\<USER>\ -> .config\opencode\ -> node_modules\ -> package.json -> bun.lock -> .gitignore -> .local -> state\opencode\ -> kv.json -> share\opencode\ -> log -> storage -> bin -> auth.json ``` - Why would opencode create all these files under `.config\opencode\` if it has its "internal" state dir at `.local\state`. - When I create an opencode.jsonc file under C:\Users\<USER>\.config\opencode\opencode.jsonc file it does not get picked up. - The opencode UI does not show which files it effectively is loading from where. And by reading the documentation it is not clear where opencode "magically" stores the model authentications or any settings interactively applied via the UI like changing the theme. All this leaves one very puzzled.
Author
Owner

@pmavrodiev commented on GitHub (Feb 2, 2026):

The configs are an absolute mess. I've never seen a case where the most important user configuration file is not even created by default. Instead once has to figure out what the syntax is to create it properly. That I shouldn't be "touching" certain files is not a reason to scatter them all over my disk.

@pmavrodiev commented on GitHub (Feb 2, 2026): The configs are an absolute mess. I've never seen a case where the most important user configuration file is not even created by default. Instead once has to figure out what the syntax is to create it properly. That I shouldn't be "touching" certain files is not a reason to scatter them all over my disk.
Author
Owner

@agarzon commented on GitHub (Feb 2, 2026):

Well, i'm glad i'm not the only one who noticed the mess with that approach 😁

It makes it impossible to share configurations when you have opencode installed in different machines (mac vs linux vs windows) like my case where I use the dotfile approach and syncthing.

I hope the author can reconsider that structure and do what others CLI's are doing.

@agarzon commented on GitHub (Feb 2, 2026): Well, i'm glad i'm not the only one who noticed the mess with that approach 😁 It makes it impossible to share configurations when you have `opencode` installed in different machines (mac vs linux vs windows) like my case where I use the dotfile approach and syncthing. I hope the author can reconsider that structure and do what others CLI's are doing.
Author
Owner

@FuzzySlipper commented on GitHub (Feb 13, 2026):

I agree this is confusing behavior.

@FuzzySlipper commented on GitHub (Feb 13, 2026): I agree this is confusing behavior.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2787