Skip to content

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

Description

@codeAnqiang-ma

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions