Persistent invalid reasoning value ("low") overrides env and CLI settings #7162

Closed
opened 2026-02-16 18:06:21 -05:00 by yindo · 10 comments
Owner

Originally created by @xuxiaoyang-if on GitHub (Jan 22, 2026).

Originally assigned to: @R44VC0RP on GitHub.

Description

Bug Description

When running opencode with gpt-5.2-chat-latest, the CLI fails with:
Error: Unsupported value: ‘low’ is not supported with the ‘gpt-5.2-chat-latest’ model.
Supported values are: ‘medium’.

This occurs even when:

  • OPENCODE_REASONING=medium is exported
  • No agent config sets low
  • Binary is reinstalled
  • Issue reproduces in both CLI and VS Code

Root Cause (Identified)

The invalid reasoning value (low) was persisted in local state directories:
~/.local/share/opencode
~/.config/opencode

Removing these directories resolves the issue immediately:

rm -rf ~/.local/share/opencode
rm -rf ~/.config/opencode

Expected Behavior
	•	Invalid or unsupported reasoning values should not silently persist
	•	Cached state should not override environment variables or CLI defaults
	•	A warning or validation should occur when loading incompatible state

Environment
	•	OS: macOS (Apple Silicon)
	•	Shell: zsh
	•	opencode version: 1.1.30
	•	Install method: curl installer

### Plugins

_No response_

### OpenCode version

1.1.30

### Steps to reproduce

_No response_

### Screenshot and/or share link

_No response_

### Operating System

macOS 26.2

### Terminal

kitty
Originally created by @xuxiaoyang-if on GitHub (Jan 22, 2026). Originally assigned to: @R44VC0RP on GitHub. ### Description ### Bug Description When running `opencode` with `gpt-5.2-chat-latest`, the CLI fails with: Error: Unsupported value: ‘low’ is not supported with the ‘gpt-5.2-chat-latest’ model. Supported values are: ‘medium’. This occurs even when: - `OPENCODE_REASONING=medium` is exported - No agent config sets `low` - Binary is reinstalled - Issue reproduces in both CLI and VS Code --- ### Root Cause (Identified) The invalid reasoning value (`low`) was persisted in local state directories: ~/.local/share/opencode ~/.config/opencode Removing these directories resolves the issue immediately: ```bash rm -rf ~/.local/share/opencode rm -rf ~/.config/opencode Expected Behavior • Invalid or unsupported reasoning values should not silently persist • Cached state should not override environment variables or CLI defaults • A warning or validation should occur when loading incompatible state Environment • OS: macOS (Apple Silicon) • Shell: zsh • opencode version: 1.1.30 • Install method: curl installer ### Plugins _No response_ ### OpenCode version 1.1.30 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System macOS 26.2 ### Terminal kitty
yindo added the bug label 2026-02-16 18:06:21 -05:00
yindo closed this issue 2026-02-16 18:06:21 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 22, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #5934: Session todo-list is forgotten after compaction (related state persistence issue)
  • #9086: Config variables overwritten with actual values on startup (config state override issue)

The root cause appears to be related to how cached state persists and overrides environment variables or CLI defaults. Other related issues that discuss configuration persistence and validation:

  • #7174: Persist desktop/web steps panel collapse state across sessions
  • #6719: Slash command for reload

Feel free to ignore if your specific issue about reasoning values is distinct from these configuration override problems.

@github-actions[bot] commented on GitHub (Jan 22, 2026): This issue might be a duplicate of existing issues. Please check: - #5934: Session todo-list is forgotten after compaction (related state persistence issue) - #9086: Config variables overwritten with actual values on startup (config state override issue) The root cause appears to be related to how cached state persists and overrides environment variables or CLI defaults. Other related issues that discuss configuration persistence and validation: - #7174: Persist desktop/web steps panel collapse state across sessions - #6719: Slash command for reload Feel free to ignore if your specific issue about reasoning values is distinct from these configuration override problems.
Author
Owner

@Luketto8 commented on GitHub (Jan 30, 2026):

This issue persists in my case even after deleting said files.
Only problem appears to be chatgpt as some free models seem to function properly

@Luketto8 commented on GitHub (Jan 30, 2026): This issue persists in my case even after deleting said files. Only problem appears to be chatgpt as some free models seem to function properly
Author
Owner

@trogers1 commented on GitHub (Jan 30, 2026):

Fwiw, I tried deleting everything opencode-related that I could find that seemed like it could potentially have something cached for opencode:

rm -rf ~/.cache/opencode \
rm -rf ~/.local/share/opencode \
rm -rf ~/.local/share/opentui/opencode \
rm -rf ~/.local/state/opencode \
rm -rf ~/.config/opencode \
rm -rf ~/.opencode \
rm -rf ~/.bun/install/cache/@opencode-ai \
brew uninstall opencode

Then re-install, re-authenticate with OpenAI (via API Token)--Issue still persists.

@trogers1 commented on GitHub (Jan 30, 2026): Fwiw, I tried deleting everything opencode-related that I could find that seemed like it could potentially have something cached for opencode: ```bash rm -rf ~/.cache/opencode \ rm -rf ~/.local/share/opencode \ rm -rf ~/.local/share/opentui/opencode \ rm -rf ~/.local/state/opencode \ rm -rf ~/.config/opencode \ rm -rf ~/.opencode \ rm -rf ~/.bun/install/cache/@opencode-ai \ brew uninstall opencode ``` Then re-install, re-authenticate with OpenAI (via API Token)--Issue still persists.
Author
Owner

@R44VC0RP commented on GitHub (Jan 30, 2026):

Can you try running opencode upgrade @trogers1 as well as opencode export > session.json so I can see the session output?

@R44VC0RP commented on GitHub (Jan 30, 2026): Can you try running `opencode upgrade` @trogers1 as well as `opencode export > session.json` so I can see the session output?
Author
Owner

@trogers1 commented on GitHub (Jan 30, 2026):

@R44VC0RP I had already uninstall+reinstalled so the upgrade command didn't do anything. But here's the exported session.json (with very minor edits for security):

{
  "info": {
    "id": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk",
    "slug": "misty-cabin",
    "version": "1.1.40",
    "projectID": "global",
    "directory": "/Code/debug",
    "title": "System plan mode: read-only analysis and delegation",
    "time": {
      "created": 1769804606485,
      "updated": 1769804606626
    },
    "summary": {
      "additions": 0,
      "deletions": 0,
      "files": 0
    }
  },
  "messages": [
    {
      "info": {
        "id": "msg_c10932c18001j49NhjsK5q9nTp",
        "sessionID": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk",
        "role": "user",
        "time": {
          "created": 1769804606493
        },
        "summary": {
          "title": "Text-only input: brief note \"Test\"",
          "diffs": []
        },
        "agent": "plan",
        "model": {
          "providerID": "openai",
          "modelID": "gpt-5.2-chat-latest"
        }
      },
      "parts": [
        {
          "id": "prt_c10932c180023XvXLt3PzJSCRp",
          "sessionID": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk",
          "messageID": "msg_c10932c18001j49NhjsK5q9nTp",
          "type": "text",
          "text": "Test"
        }
      ]
    },
    {
      "info": {
        "id": "msg_c10932c2d002s9sPM8svmgEbyg",
        "sessionID": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk",
        "role": "assistant",
        "time": {
          "created": 1769804606509,
          "completed": 1769804606783
        },
        "error": {
          "name": "APIError",
          "data": {
            "message": "Unsupported value: 'low' is not supported with the 'gpt-5.2-chat-latest' model. Supported values are: 'medium'.",
            "statusCode": 400,
            "isRetryable": false,
            "responseHeaders": {
              "alt-svc": "h3=\":443\"; ma=86400",
              "cf-cache-status": "DYNAMIC",
              "cf-ray": "9c63afe78f997851-SJC",
              "connection": "keep-alive",
              "content-length": "250",
              "content-type": "application/json",
              "date": "Fri, 30 Jan 2026 20:23:26 GMT",
              "openai-organization": "HIDDEN",
              "openai-processing-ms": "56",
              "openai-project": "HIDDEN",
              "openai-version": "2020-10-01",
              "server": "cloudflare",
              "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
              "x-content-type-options": "nosniff",
              "x-request-id": "req_2c5d841c1a2c4699bdd82f83f0e37c95",
              "set-cookie": "HIDDEN"
            },
            "responseBody": "{\n  \"error\": {\n    \"message\": \"Unsupported value: 'low' is not supported with the 'gpt-5.2-chat-latest' model. Supported values are: 'medium'.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"text.verbosity\",\n    \"code\": \"unsupported_value\"\n  }\n}",
            "metadata": {
              "url": "https://api.openai.com/v1/responses"
            }
          }
        },
        "parentID": "msg_c10932c18001j49NhjsK5q9nTp",
        "modelID": "gpt-5.2-chat-latest",
        "providerID": "openai",
        "mode": "plan",
        "agent": "plan",
        "path": {
          "cwd": "/Code/debug",
          "root": "/"
        },
        "cost": 0,
        "tokens": {
          "input": 0,
          "output": 0,
          "reasoning": 0,
          "cache": {
            "read": 0,
            "write": 0
          }
        }
      },
      "parts": []
    }
  ]
}
@trogers1 commented on GitHub (Jan 30, 2026): @R44VC0RP I had already uninstall+reinstalled so the `upgrade` command didn't do anything. But here's the exported session.json (with very minor edits for security): ```json { "info": { "id": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk", "slug": "misty-cabin", "version": "1.1.40", "projectID": "global", "directory": "/Code/debug", "title": "System plan mode: read-only analysis and delegation", "time": { "created": 1769804606485, "updated": 1769804606626 }, "summary": { "additions": 0, "deletions": 0, "files": 0 } }, "messages": [ { "info": { "id": "msg_c10932c18001j49NhjsK5q9nTp", "sessionID": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk", "role": "user", "time": { "created": 1769804606493 }, "summary": { "title": "Text-only input: brief note \"Test\"", "diffs": [] }, "agent": "plan", "model": { "providerID": "openai", "modelID": "gpt-5.2-chat-latest" } }, "parts": [ { "id": "prt_c10932c180023XvXLt3PzJSCRp", "sessionID": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk", "messageID": "msg_c10932c18001j49NhjsK5q9nTp", "type": "text", "text": "Test" } ] }, { "info": { "id": "msg_c10932c2d002s9sPM8svmgEbyg", "sessionID": "ses_3ef6cd3eaffeMDaSwUTXAWz6Hk", "role": "assistant", "time": { "created": 1769804606509, "completed": 1769804606783 }, "error": { "name": "APIError", "data": { "message": "Unsupported value: 'low' is not supported with the 'gpt-5.2-chat-latest' model. Supported values are: 'medium'.", "statusCode": 400, "isRetryable": false, "responseHeaders": { "alt-svc": "h3=\":443\"; ma=86400", "cf-cache-status": "DYNAMIC", "cf-ray": "9c63afe78f997851-SJC", "connection": "keep-alive", "content-length": "250", "content-type": "application/json", "date": "Fri, 30 Jan 2026 20:23:26 GMT", "openai-organization": "HIDDEN", "openai-processing-ms": "56", "openai-project": "HIDDEN", "openai-version": "2020-10-01", "server": "cloudflare", "strict-transport-security": "max-age=31536000; includeSubDomains; preload", "x-content-type-options": "nosniff", "x-request-id": "req_2c5d841c1a2c4699bdd82f83f0e37c95", "set-cookie": "HIDDEN" }, "responseBody": "{\n \"error\": {\n \"message\": \"Unsupported value: 'low' is not supported with the 'gpt-5.2-chat-latest' model. Supported values are: 'medium'.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"text.verbosity\",\n \"code\": \"unsupported_value\"\n }\n}", "metadata": { "url": "https://api.openai.com/v1/responses" } } }, "parentID": "msg_c10932c18001j49NhjsK5q9nTp", "modelID": "gpt-5.2-chat-latest", "providerID": "openai", "mode": "plan", "agent": "plan", "path": { "cwd": "/Code/debug", "root": "/" }, "cost": 0, "tokens": { "input": 0, "output": 0, "reasoning": 0, "cache": { "read": 0, "write": 0 } } }, "parts": [] } ] } ```
Author
Owner

@R44VC0RP commented on GitHub (Jan 30, 2026):

Confirmed this, was able to repro. 👍🏻

Image
@R44VC0RP commented on GitHub (Jan 30, 2026): Confirmed this, was able to repro. 👍🏻 <img width="897" height="853" alt="Image" src="https://github.com/user-attachments/assets/4e64f2e0-844d-4a9e-82fb-4369e592785a" />
Author
Owner

@Luketto8 commented on GitHub (Jan 30, 2026):

Did some light digging and the following caught my eye. Might be worth checking out.

gpt-5.2 modelID worked for me,
but gpt-5.2-chat-latest does not.

So appears to misbehave at

      if (
        input.model.api.id.includes("gpt-5.") &&
        !input.model.api.id.includes("codex") &&
        input.model.providerID !== "azure"
      ) {
        result["textVerbosity"] = "low"
      }
@Luketto8 commented on GitHub (Jan 30, 2026): Did some light digging and the following caught my eye. Might be worth checking out. > gpt-5.2 modelID worked for me, > but gpt-5.2-chat-latest does not. So appears to misbehave at ```ts if ( input.model.api.id.includes("gpt-5.") && !input.model.api.id.includes("codex") && input.model.providerID !== "azure" ) { result["textVerbosity"] = "low" } ```
Author
Owner

@R44VC0RP commented on GitHub (Jan 30, 2026):

Merged the fix, thanks for the help!

@R44VC0RP commented on GitHub (Jan 30, 2026): Merged the fix, thanks for the help!
Author
Owner

@cdenneen commented on GitHub (Feb 4, 2026):

@R44VC0RP is there a fix on 1.1.47? I'm using nixpkgs-unstable. This was working for me on gpt-5.2-chat for a while and then all of a sudden seemed to break. I've reviewed everything in ~/.local/share/opencode and ~/.config/opencode and don't see anything referencing "low" so not sure how to properly override. Seems the PR that was merged was for an environment variable to overwrite a opencode.json? But in my case no opencode.json has any mention of low. How can I fix this?

@cdenneen commented on GitHub (Feb 4, 2026): @R44VC0RP is there a fix on 1.1.47? I'm using nixpkgs-unstable. This was working for me on gpt-5.2-chat for a while and then all of a sudden seemed to break. I've reviewed everything in ~/.local/share/opencode and ~/.config/opencode and don't see anything referencing "low" so not sure how to properly override. Seems the PR that was merged was for an environment variable to overwrite a opencode.json? But in my case no opencode.json has any mention of low. How can I fix this?
Author
Owner

@R44VC0RP commented on GitHub (Feb 4, 2026):

I don't think it would be available in 1.1.47, I would try 1.1.51 for best success

@R44VC0RP commented on GitHub (Feb 4, 2026): I don't think it would be available in 1.1.47, I would try 1.1.51 for best success
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7162