Skip to content

One configuration file cannot be used by version 1 and version 2 #41081

Closed

Description

@Majidalee1

Description

Version 1 and version 2 can be installed at the same time. The two versions read the same configuration file. But one file cannot satisfy both versions.

Version 1 stops with an error when the file contains the version 2 keys. The keys are providers and agents. Version 1 shows this message:

Configuration is invalid at <config-dir>/opencode.json
↳ Unrecognized keys: providers, agents

The migration document is at https://opencode.ai/v2/docs/migrate-v1

The document says that version 1 fields and version 2 fields can stay together in one file. The document says: "Supported V1 and native V2 fields may coexist at the top level". The document also says: "when both forms set the same canonical value, a valid native V2 value takes precedence". Thus the user can write the provider with the version 1 fields.

Version 2 does not obey this rule for a custom provider package.

I declare a provider with the version 1 fields. I use the provider key. I use the npm field. Version 1 reads the file correctly. But version 2 shows no models for this provider. Version 2 shows no error message.

I declare the same provider with the version 2 fields. I use the providers key. I use the package field. Version 2 shows all 32 models. But version 1 stops with the error above.

Thus neither format is correct for both versions.

The fault does not occur for all packages. A provider with the @ai-sdk/openai-compatible package loads correctly with the version 1 fields. The fault occurs with the package commandcode-go-opencode-provider.

Environment

  • opencode version 2: 0.0.0-next-16974 (next channel)
  • opencode version 1: 1.18.15
  • Operating system: macOS 25.5.0
  • Architecture: arm64

How to repeat the fault

  1. Install the package commandcode-go-opencode-provider from npm.
  2. Put configuration A in the global configuration file.
  3. Run this command with version 2: opencode models
  4. Count the lines that start with commandcode/.
  5. Run the same command with version 1.
  6. Put configuration B in the same file.
  7. Do step 3 to step 5 again.

Configuration A uses the version 1 fields:

{
  "provider": {
    "commandcode": {
      "npm": "commandcode-go-opencode-provider",
      "name": "Command Code",
      "env": ["COMMANDCODE_API_KEY"],
      "options": { "baseURL": "https://api.commandcode.ai" },
      "models": {
        "deepseek-v4-flash": {
          "id": "deepseek/deepseek-v4-flash",
          "name": "DeepSeek V4 Flash",
          "tool_call": true
        }
      }
    }
  }
}

Configuration B uses the version 2 fields:

{
  "providers": {
    "commandcode": {
      "package": "aisdk:commandcode-go-opencode-provider",
      "name": "Command Code",
      "settings": { "baseURL": "https://api.commandcode.ai" },
      "models": {
        "deepseek-v4-flash": {
          "modelID": "deepseek/deepseek-v4-flash",
          "name": "DeepSeek V4 Flash",
          "capabilities": { "tools": true }
        }
      }
    }
  }
}

Result

Configuration A: version 2 shows 0 models for the provider. There is no error message. Version 1 shows all models.

Configuration B: version 2 shows all models. Version 1 stops with the error message.

I did more tests with configuration A. The result stays the same for each test:

  • The package field and the npm field together in the provider key.
  • Only the package field in the provider key.
  • Model entries with only version 1 fields. I removed modelID, capabilities and cost.cache.

A second file does not correct the problem. Both versions read the file opencode.jsonc. Version 1 also stops with an error for that file.

Expected result

Version 2 must load the provider when the configuration uses the version 1 fields. Then one file can satisfy both versions.

If version 2 cannot load the provider, then version 2 must show an error message.

Activity

  1. changed the title [-]Version 2 does not load a provider that uses the version 1 provider and npm fields[/-] [+]One configuration file cannot be used by version 1 and version 2[/+] on Aug 7, 2026
  2. opencode-agent commented on Aug 17, 2026

    @opencode-agent
    Contributor

    This is no longer an issue on the current V2/beta branch. #40919 added V1 configuration normalization: a legacy provider entry is converted in memory to the V2 provider shape, including npm → aisdk:<package>, options → settings, and legacy model fields such as id and tool_call. As a result, configuration A can be shared by V1 and V2 and the custom provider models are loaded by V2.

    Native V2-only keys such as providers and agents are still not accepted by V1; users running both versions should retain the supported V1 form in the shared file.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions