V2 config: ignore {file:...} in JSONC comments
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
The issue is in the V2 config parser's token substitution logic. Look for the code that handles {file:...} tokens, likely in a file like src/config/parser.ts or similar. The fix needs to skip tokens inside JSONC comments (// and /* */), not just lines starting with //. Start by running the provided reproduction steps to see the failure, then examine the linked pull request #50899 for context on the intended fix.
Written by the indexing model from the issue text.
Description
Description
In V2, a {file:...} token inside an inline // or /* ... */ comment in opencode.jsonc is treated as a real file reference. If that file does not exist, an otherwise valid config fails to load. The current substitution code skips only lines that begin with //.
Expected: comments are left alone; only active config values are substituted. Missing files in active values should still be errors.
Related #14478 concerned an active token shadowed by a commented duplicate in the older config path; here V2 dereferences tokens that occur only in comments.
Implementation: #50899 (targets v2).
Plugins
None
OpenCode version
V2 9c8a63e852722a9bced4a0de1179de58a85dfa20
Steps to reproduce
-
Create
opencode.jsoncwith:{ "username": "demo" // {file:./not-present.txt} } -
Load the configuration. It fails trying to read
not-present.txteven though the token is in a comment. A block comment containing the token has the same problem.
Screenshot and/or share link
Not applicable. A Core config regression test reproduces the failure with NotFound for missing-inline.txt before the fix.
Operating System
Linux x86_64
Terminal
Not applicable (Core test)
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 9h 42m
- Merged PRs (30d)
- 389
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.
More from anomalyco/opencode
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
All issues in anomalyco/opencode
Similar issues
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Crush Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ElementsProject/cln-application#167 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Quantco/pnpm-licenses#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100