Skip to content

file substitution in configuration results in "invalid JSON" #1440

Closed

Description

@muni-corn

configuration file

using Nix as my configuration tool of choice, my setup (opencode.nix results in this config.json:

{
  "$schema": "https://opencode.ai/config.json",
  "autoupdate": false,
  "mcp": {
    // ...
    "github": {
      "enabled": true,
      "headers": {
        "Authorization": "Bearer {file:/home/muni/.config/sops-nix/secrets/github_pat}"
      },
      "type": "remote",
      "url": "https://api.githubcopilot.com/mcp/"
    },
    // ...
  }
}

observed behavior

when i run opencode, i get:

Error: Config file at /home/muni/.config/opencode/config.json is not valid JSON

if i remove the headers object, opencode can start as expected again, without error.

expected behavior

i expect opencode to substitute the contents of my file into the Authorization header, as documented here: https://opencode.ai/docs/config/#files

i assume it works with remote mcp configurations too, at least 😅 https://opencode.ai/docs/mcp-servers/#remote

opencode version

i just upgraded to opencode 0.3.85, but this issue has been present since 0.3.80 as well.

other notes

the github_pat file has a permissions mode of 400. it is not a symlink.

Activity

  1. rekram1-node commented on Aug 1, 2025

    @rekram1-node
    Member

    I will have a fix up for this later tonight, thanks for calling it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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