Skip to content

[Bug]: parseGenericCliVersion fails on "v"-prefixed versions, e.g. "opencode v2.0.3" #11737

Description

@NikodemNowak

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Summary

With OpenCode 2.0.3 installed, T3 Code reports the OpenCode provider as unavailable:

OpenCode — Unavailable · Failed to execute OpenCode CLI health check: Unable to determine OpenCode version from `opencode --version` output. T3 Code requires OpenCode v1.14.19 or newer.

The CLI itself works fine:

$ opencode --version
opencode v2.0.3

Steps to reproduce

  1. Install OpenCode 2.x so that opencode --version prints opencode v2.0.3.
  2. In T3 Code, enable OpenCode under Settings > Providers and keep the default opencode binary path.
  3. Refresh provider status.

The parser also fails in isolation:

"opencode v2.0.3".match(/\b(\d+\.\d+\.\d+)\b/) // null

Expected behavior

parseGenericCliVersion should return "2.0.3" for opencode v2.0.3, and the health check should not claim that it cannot determine the version. (Whether OpenCode 2 then runs is the separate OpenCode 2 runtime track, see Related.)

Actual behavior

parseGenericCliVersion in apps/server/src/provider/providerSnapshot.ts uses:

output.match(/\b(\d+\.\d+\.\d+)\b/)

The leading \b requires a word boundary before the major version, but in v2.0.3 the v and the 2 are both word characters, so there is no boundary and the match fails. The provider then falls into the "Unable to determine OpenCode version" branch even though the CLI is installed and newer than the minimum version.

parseSemver in packages/shared/src/semver.ts already accepts a leading v (replace(/^v/, "")), so the two version parsers are inconsistent.

Impact

Blocks work completely for OpenCode 2.x users: the provider cannot be enabled at all, and the error message hides the real cause. The parser is shared by the OpenCode, Claude, and Grok providers, so this is not OpenCode-specific.

Version or commit

  • T3 Code 0.0.40 (desktop)
  • Reproduces on main @ 9375c77
  • OpenCode 2.0.3 (opencode --version -> opencode v2.0.3)

Environment

  • Windows 11, T3 Code desktop 0.0.40
  • OpenCode 2.0.3 installed via npm
  • The bug is platform independent (pure string parsing)

Logs or stack traces

OpenCode — Unavailable · Failed to execute OpenCode CLI health check:
Unable to determine OpenCode version from `opencode --version` output.
T3 Code requires OpenCode v1.14.19 or newer.

Workaround

Wrap the CLI so that --version prints a bare X.Y.Z and forward every other argument to opencode.

Related

Activity

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