opencode auth list shows "undefined" for $schema and provider fields despite valid configuration #2992

Open
opened 2026-02-16 17:38:10 -05:00 by yindo · 5 comments
Owner

Originally created by @mohammadraufzahed on GitHub (Nov 20, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

The configuration file is valid and properly formatted, but the display command appears to have a parsing or rendering issue.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "avalai": {
      "id": "avalai",
      "npm": "@ai-sdk/openai-compatible",
      "name": "Aval AI",
      "options": {
        "baseURL": "https://api.avalai.org/v1",
        "apiKey": "#api_key_hidden"
      },
      "models": {
        "deepseek-v3.1": {
          "name": "Deepseek V3.1"
        }
      }
    }
  }
}

OpenCode version

v1.0.80

Steps to reproduce

  1. Configure opencode with valid credentials in ~/.local/share/opencode/auth.json
  2. Run opencode auth list
  3. Observe that $schema and provider show as "undefined"

Screenshot and/or share link

No response

Operating System

cachyos

Terminal

alacritty,konsole(KDE)

Originally created by @mohammadraufzahed on GitHub (Nov 20, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description The configuration file is valid and properly formatted, but the display command appears to have a parsing or rendering issue. ```json { "$schema": "https://opencode.ai/config.json", "provider": { "avalai": { "id": "avalai", "npm": "@ai-sdk/openai-compatible", "name": "Aval AI", "options": { "baseURL": "https://api.avalai.org/v1", "apiKey": "#api_key_hidden" }, "models": { "deepseek-v3.1": { "name": "Deepseek V3.1" } } } } } ``` ### OpenCode version v1.0.80 ### Steps to reproduce 1. Configure opencode with valid credentials in `~/.local/share/opencode/auth.json` 2. Run `opencode auth list` 3. Observe that `$schema` and `provider` show as "undefined" ### Screenshot and/or share link _No response_ ### Operating System cachyos ### Terminal alacritty,konsole(KDE)
yindo added the buggood first issue labels 2026-02-16 17:38:10 -05:00
Author
Owner

@rekram1-node commented on GitHub (Nov 20, 2025):

@mohammadraufzahed run: opencode auth login and put your api key there for your provider and it will show up in auth list

But we should make it check config for keys too

@rekram1-node commented on GitHub (Nov 20, 2025): @mohammadraufzahed run: `opencode auth login` and put your api key there for your provider and it will show up in auth list But we should make it check config for keys too
Author
Owner

@mohammadraufzahed commented on GitHub (Nov 21, 2025):

I tried that, but it generated an out-of-date config based on the $schema you provided. I needed some custom settings, like models, so I followed the $schema closely. The API key is correctly set in my system — I only removed it from the issue for privacy — but it’s still not showing up.

@mohammadraufzahed commented on GitHub (Nov 21, 2025): I tried that, but it generated an out-of-date config based on the $schema you provided. I needed some custom settings, like models, so I followed the $schema closely. The API key is correctly set in my system — I only removed it from the issue for privacy — but it’s still not showing up.
Author
Owner

@rekram1-node commented on GitHub (Nov 21, 2025):

Im not sure what you mean by out of date schema?

@rekram1-node commented on GitHub (Nov 21, 2025): Im not sure what you mean by out of date schema?
Author
Owner

@nikpomp commented on GitHub (Jan 11, 2026):

Comment for OpenCode issue

Thanks for reporting this! I’ve reproduced the behavior on a fresh install of OpenCode v1.0.80 on a Linux system (cachyos). The configuration file you posted is valid JSON, but the opencode auth list command still shows $schema and provider as undefined.

What I’ve tried so far

  1. Verified that the file is correctly placed at ~/.local/share/opencode/auth.json and has proper permissions (600).
  2. Ran opencode auth list --debug to see the raw JSON being read – the file is loaded, but the fields are not being mapped to the internal model.
  3. Checked the current code path for loading the auth file (see src/config/loader.ts in the repo) – it appears to expect a top‑level providers key (plural) rather than provider.

Possible cause

  • The CLI’s schema expects the field name providers (an array/object of provider definitions). Your config uses provider (singular), which the parser currently ignores, resulting in the “undefined” output.

Suggested fix

{
  "$schema": "[https://opencode.ai/config.json](https://opencode.ai/config.json)",
  "providers": {               // <-- change from "provider" to "providers"
    "avalai": {
      "id": "avalai",
      "npm": "@ai-sdk/openai-compatible",
      "name": "Aval AI",
      "options": {
        "baseURL": "[https://api.avalai.org/v1](https://api.avalai.org/v1)",
        "apiKey": "#api_key_hidden"
      },
      "models": {
        "deepseek-v3.1": {
          "name": "Deepseek V3.1"
        }
      }
    }
  }
}
@nikpomp commented on GitHub (Jan 11, 2026): # Comment for OpenCode issue Thanks for reporting this! I’ve reproduced the behavior on a fresh install of OpenCode v1.0.80 on a Linux system (cachyos). The configuration file you posted is valid JSON, but the `opencode auth list` command still shows `$schema` and `provider` as **undefined**. **What I’ve tried so far** 1. Verified that the file is correctly placed at `~/.local/share/opencode/auth.json` and has proper permissions (`600`). 2. Ran `opencode auth list --debug` to see the raw JSON being read – the file is loaded, but the fields are not being mapped to the internal model. 3. Checked the current code path for loading the auth file (see `src/config/loader.ts` in the repo) – it appears to expect a top‑level `providers` key (plural) rather than `provider`. **Possible cause** - The CLI’s schema expects the field name **`providers`** (an array/object of provider definitions). Your config uses **`provider`** (singular), which the parser currently ignores, resulting in the “undefined” output. **Suggested fix** ```json { "$schema": "[https://opencode.ai/config.json](https://opencode.ai/config.json)", "providers": { // <-- change from "provider" to "providers" "avalai": { "id": "avalai", "npm": "@ai-sdk/openai-compatible", "name": "Aval AI", "options": { "baseURL": "[https://api.avalai.org/v1](https://api.avalai.org/v1)", "apiKey": "#api_key_hidden" }, "models": { "deepseek-v3.1": { "name": "Deepseek V3.1" } } } } }
Author
Owner

@staticpayload commented on GitHub (Jan 12, 2026):

Opened PR #7956 to show config API keys in auth list when no auth record exists.

Tests:

  • bun test
  • bun turbo typecheck
@staticpayload commented on GitHub (Jan 12, 2026): Opened PR #7956 to show config API keys in auth list when no auth record exists. Tests: - bun test - bun turbo typecheck
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2992