router-for-me/CLIProxyAPI · error

missing required field version

Error message

missing required field version

What it means

Returned by Manifest.Validate (manifest.go:102-106) as the first validation step: the Version field is empty after trimming. Every manifest — whether installed via InstallManifest, generated by ManifestFromPlugin, or validated standalone — must carry an explicit version because it feeds the versioned library filename (<id>-v<version><ext>) and version equality checks during install.

Source

Thrown at internal/pluginstore/manifest.go:105

		Homepage:    strings.TrimSpace(m.Homepage),
		License:     strings.TrimSpace(m.License),
		Tags:        append([]string(nil), m.Tags...),
		Install:     NormalizeInstallPlan(m.Install),
	}
}

func (m Manifest) InstallType() string {
	installType := strings.ToLower(strings.TrimSpace(m.Install.Type))
	if installType == "" {
		return InstallTypeGitHubRelease
	}
	return installType
}

func (m Manifest) Validate() error {
	version := strings.TrimSpace(m.Version)
	if version == "" {
		return fmt.Errorf("missing required field version")
	}
	if !validPluginVersion(normalizeVersion(version)) {
		return fmt.Errorf("invalid plugin version %q", m.Version)
	}
	switch m.InstallType() {
	case InstallTypeDirect:
		if m.SchemaVersion != 0 && m.SchemaVersion != SchemaVersionV2 {
			return fmt.Errorf("unsupported schema-version %d", m.SchemaVersion)
		}
		if errID := validateManifestPluginID(m.ID); errID != nil {
			return errID
		}
		plan := NormalizeInstallPlan(m.Install)
		plan.Type = InstallTypeDirect
		if len(plan.Artifacts) > 0 {
			if errValidate := ValidateInstallPlan(plan); errValidate != nil {
				return errValidate
			}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Set Manifest.Version to a valid semver-style value (e.g. 1.2.3) matching the release tag for github-release manifests
  2. If generating from a release, use ManifestFromRelease which derives Version via ReleaseVersion
  3. Check the field your deserializer actually populated — the yaml tag is 'version', the json tag is 'version_'

Example fix

# before (manifest yaml)
id: myplugin
install:
  type: github-release
release-tag: v1.2.3
# after
id: myplugin
version: 1.2.3
install:
  type: github-release
release-tag: v1.2.3
Defensive patterns

Strategy: validation

Validate before calling

func manifestHasVersion(m pluginstore.Manifest) error {
    if strings.TrimSpace(m.Version) == "" {
        return errors.New("manifest missing version")
    }
    return nil
}

Type guard

func manifestVersionPresent(m pluginstore.Manifest) bool {
    return strings.TrimSpace(m.Version) != ""
}

Try / catch

if err := manifest.Validate(); err != nil {
    if strings.Contains(err.Error(), "missing required field version") {
        // populate Version (from release tag or build metadata) and re-validate
    }
}

Prevention

When it happens

Trigger: Calling InstallManifest or Manifest.Validate on a Manifest whose Version was never set: a hand-written plugin manifest YAML omitting 'version:', a manifest built via struct literal without Version, or a github-release manifest whose version was expected to be inferred (it is not — ManifestFromRelease fills it from the release tag).

Common situations: Authoring a plugin manifest and forgetting the version field; deserialization mismatch (JSON uses version_version snake_case 'version_' vs yaml 'version' — populating the wrong tag silently leaves it empty); assuming Validate fills defaults (it only rejects).

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/f5753904d790c549. Report an issue: GitHub.