anomalyco / anomalyco/opencode
PATCH /global/config cannot remove a config entry (null is rejected)
@jlongster is already working on this.
Since Aug 17, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
PATCH /global/config can add and change config entries but can never delete one.
The body is merged into the existing config, so omitting a key preserves it and {} is a no-op. The only way a merge can express a removal is null, and null is rejected by the payload schema:
$ curl -s -X PATCH localhost:4096/global/config \
-H 'content-type: application/json' \
-d '{"provider":{"my-endpoint":null}}'
{"_tag":"BadRequest",...} # Expected ProviderConfig, got null
{"provider":{"my-endpoint":{}}} returns 200 but leaves the key in place, so there is no workaround through the endpoint.
This means an API client can create a provider / agent / mcp / reference entry but has no supported way to remove it — the only route left is editing opencode.jsonc behind opencode's back, which loses the in-memory update and races the next PATCH.
Worth noting the delete already works internally: both write paths drop a member whose value is undefined (jsonc-parser's modify deletes the key, JSON.stringify omits it) — writableGlobal already relies on this to clear shell. The gap is only that JSON can't carry undefined over the wire, and null isn't accepted in its place.
Plugins
No response
OpenCode version
1.18.10
Steps to reproduce
opencode servecurl -X PATCH localhost:4096/global/config -H 'content-type: application/json' -d '{"provider":{"x":{"options":{"baseURL":"http://x"}}}}'— the provider is addedcurl -X PATCH localhost:4096/global/config -H 'content-type: application/json' -d '{"provider":{"x":null}}'— 400curl -X PATCH localhost:4096/global/config -H 'content-type: application/json' -d '{"provider":{"x":{}}}'— 200, butxis still there
Screenshot and/or share link
No response
Operating System
Ubuntu 24.04
Terminal
iTerm2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.