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
I tried to configure disabled_providers. One can read about
~/.config/opencode/config.json
~/.config/opencode/opencode.json
but strace shows that opencode looks at the following places:
~/.config/opencode/config.json
~/.config/opencode/opencode.json
~/.config/opencode/opencode.jsonc
$PWD/opencode.jsonc # folder where i started opencode
~/opencode.jsonc
/home/opencode.jsonc
/opencode.jsonc
$PWD/opencode.json # folder where i started opencode
~/opencode.json
/home/opencode.json
/opencode.json
/opencode.json wins, so if i centrally provide /opencode.json, i override the user specific setting - this is fine.
But /opencode.json?! Why not /etc/...?
I wonder if the paths are intentional. From my point of view, it might make more sense that way:
~/.config/opencode/config.json or $HOME/.config/opencode/opencode.json
$PWD/opencode.json
/etc/opencode.json or /etc/opencode/opencode.json or /etc/opencode/config.json
To clear up the confusion surrounding opencode.json vs. config.json, I would probably opt for opencode.json (which can be found in the documentation e.g. https://opencode.ai/docs/rules/#custom-instructions) - so maybe:
$HOME/.config/opencode/opencode.json
$PWD/opencode.json # by this I mean the project folder in which opencode works.
/etc/opencode.json or /etc/opencode/opencode.json
The latter ones shoud always override the former ones (merge).
I used a bug report since /opencode.json is not the correct place for a central configuration in my opinion.
This is once again just for legacy support but we try to have most people use opencode.json or opencode.jsonc
This code is what causes those other file paths tho:
for (const file of ["opencode.jsonc", "opencode.json"]) {
const found = await Filesystem.findUp(file, Instance.directory, Instance.worktree)
for (const resolved of found.toReversed()) {
result = mergeDeep(result, await loadFile(resolved))
}
}
it just searches up the filesystem to check if you have any other opencode configs that it should be loading in, if you are in a git repo it should stop at the root of the repo, but if you are outside of a git repo it will look up to the global "/"
it just searches up the filesystem to check if you have any other opencode configs that it should be loading in, if you are in a git repo it should stop at the root of the repo, but if you are outside of a git repo it will look up to the global "/"
Activity
github-actions commentedon Oct 24, 2025
This issue might be a duplicate of existing issues. Please check:
~/expansion don't work in instructions configuration #3289: Glob patterns with/expansion don't work in instructions configuration (related to configuration file path handling)Feel free to ignore if none of these address your specific case about the extensive search path and /opencode.json placement.
rekram1-node commentedon Oct 24, 2025
@arlt the config.json is legacy so we search it for backwards compatibility also we search 3 diffferent ones here because they are all supported:
This is once again just for legacy support but we try to have most people use
opencode.jsonoropencode.jsoncThis code is what causes those other file paths tho:
it just searches up the filesystem to check if you have any other opencode configs that it should be loading in, if you are in a git repo it should stop at the root of the repo, but if you are outside of a git repo it will look up to the global "/"
This isn't a bug this is intentional behavior
arlt commentedon Oct 24, 2025
Ah - thanks for clarifying that.