anomalyco / anomalyco/opencode

PATCH /global/config cannot remove a config entry (null is rejected)

Open
#43,033 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. opencode serve
  2. curl -X PATCH localhost:4096/global/config -H 'content-type: application/json' -d '{"provider":{"x":{"options":{"baseURL":"http://x"}}}}' — the provider is added
  3. curl -X PATCH localhost:4096/global/config -H 'content-type: application/json' -d '{"provider":{"x":null}}' — 400
  4. curl -X PATCH localhost:4096/global/config -H 'content-type: application/json' -d '{"provider":{"x":{}}}' — 200, but x is still there
Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

iTerm2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.