larksuite/cli · error

invalid RequiredCLIVersion %q: unknown operator %q

Error message

invalid RequiredCLIVersion %q: unknown operator %q

What it means

After parsing the constraint's versions, satisfiesRequiredCLIVersion compares using the extracted operator; an operator outside {"", "=", ">=", ">", "<=", "<"} hits the default branch and returns this error naming the unsupported operator. splitConstraint only extracts a leading comparator, so this indicates a constraint grammar violation.

Source

Thrown at internal/platform/version.go:87

	if err != nil {
		// Build version is unparseable -- treat as DEV so an exotic
		// build tag doesn't lock plugins out.
		return true, nil //nolint:nilerr // intentional fail-open for unparseable buildVersion
	}
	cmp := compareSemver(bv, rv)
	switch op {
	case "=", "":
		return cmp == 0, nil
	case ">=":
		return cmp >= 0, nil
	case ">":
		return cmp > 0, nil
	case "<=":
		return cmp <= 0, nil
	case "<":
		return cmp < 0, nil
	default:
		return false, fmt.Errorf("invalid RequiredCLIVersion %q: unknown operator %q", constraint, op)
	}
}

// splitConstraint extracts the leading comparator (if any) from a
// constraint string. The operator is one of "", "=", ">=", ">", "<=", "<".
func splitConstraint(s string) (op, rest string) {
	switch {
	case strings.HasPrefix(s, ">="):
		return ">=", strings.TrimSpace(s[2:])
	case strings.HasPrefix(s, "<="):
		return "<=", strings.TrimSpace(s[2:])
	case strings.HasPrefix(s, ">"):
		return ">", strings.TrimSpace(s[1:])
	case strings.HasPrefix(s, "<"):
		return "<", strings.TrimSpace(s[1:])
	case strings.HasPrefix(s, "="):
		return "=", strings.TrimSpace(s[1:])
	default:

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Rewrite the constraint using a supported operator: =, >=, >, <=, <, or empty for exact-ish match.
  2. Replace "^1.2" with ">=1.2" (or the precise range you need, noting only a single comparator is supported).
  3. Fix typos: "=>1.2" → ">=1.2", "=<1.2" → "<=1.2".
  4. Regenerate/upgrade the plugin manifest from the plugin tooling that emits supported constraints.

Example fix

// before
"RequiredCLIVersion": "^1.2"
// after
"RequiredCLIVersion": ">=1.2"
Defensive patterns

Strategy: validation

Validate before calling

supported := map[string]bool{"": true, "=": true, ">=": true, ">": true, "<=": true, "<": true}
op, _ := splitConstraint(c)
if !supported[op] {
    return fmt.Errorf("unsupported operator %q in RequiredCLIVersion", op)
}

Prevention

When it happens

Trigger: A plugin manifest's RequiredCLIVersion uses an operator the checker doesn't support — e.g. "~1.2", "^2.0", "!=1.0", "==1.0" — or a constraint string where the extracted leading token isn't a recognized comparator.

Common situations: Plugin authors copying range syntax from npm/semver/cargo ecosystems; typos like "=>1.2" or "=<1.2"; legacy manifests written against a different constraint grammar.

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/05ab45caa7162ab0. Report an issue: GitHub.