anomalyco / anomalyco/opencode

Config parse errors echo the substituted text, not the file as written

Open
#42,308 0 comments 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 13, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Hit this while fixing a typo in my opencode.json.

I had a syntax error (forgot the value after "model":) and the config uses
{env:DEMO_KEY} for the API key. The error under "--- JSONC Input ---" printed
my config back with the actual key value where {env:DEMO_KEY} was.

I'd expect it to quote the file the way I wrote it. tui.json goes through the
same path, and that one ends up in ~/.local/share/opencode/log/opencode.log.

Plugins

No response

OpenCode version

1.18.18

Steps to reproduce
  1. Put this in opencode.json:
    {
    "$schema": "https://opencode.ai/config.json",
    "provider": { "anthropic": { "options": { "apiKey": "{env:DEMO_KEY}" } } },
    "model":
    }
  2. DEMO_KEY=sk-live-DO-NOT-PRINT opencode run "hi"
  3. Look at the block under "--- JSONC Input ---" - the apiKey line shows
    sk-live-DO-NOT-PRINT instead of {env:DEMO_KEY}, and the reported line
    number doesn't match the file.
Screenshot and/or share link
Image
Operating System

macOS 26.0.1

Terminal

No response

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.