hashicorp/nomad · error

failed to parse version %q for internal plugin %s: %v

Error message

failed to parse version %q for internal plugin %s: %v

What it means

After fingerprinting, initInternal parses the plugin's reported PluginVersion string with hashicorp/go-version. If version.NewVersion(i.PluginVersion) fails, the plugin cannot participate in API version negotiation and is skipped with this error appended to the multierror.

Source

Thrown at helper/pluginutils/loader/init.go:134

		}

		// Try to retrieve a user specified config
		if userConfig, ok := configs[k.Name]; ok && userConfig.Config != nil {
			info.config = userConfig.Config
		}

		// Fingerprint base info
		i, err := base.PluginInfo()
		if err != nil {
			_ = multierror.Append(&mErr, fmt.Errorf("PluginInfo info failed for internal plugin %s: %v", k, err))
			continue
		}
		info.baseInfo = i

		// Parse and set the plugin version
		v, err := version.NewVersion(i.PluginVersion)
		if err != nil {
			_ = multierror.Append(&mErr, fmt.Errorf("failed to parse version %q for internal plugin %s: %v", i.PluginVersion, k, err))
			continue
		}
		info.version = v

		// Detect the plugin API version to use
		av, err := l.selectApiVersion(i)
		if err != nil {
			_ = multierror.Append(&mErr, fmt.Errorf("failed to validate API versions %v for internal plugin %s: %v", i.PluginApiVersions, k, err))
			continue
		}
		if av == "" {
			l.logger.Warn("skipping plugin because supported API versions for plugin and Nomad do not overlap", "plugin", k)
			continue
		}
		info.apiVersion = av

		// Get the config schema
		schema, err := base.ConfigSchema()

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set the plugin's PluginVersion to a valid semver string such as "1.0.0" (go-version accepts an optional leading v)
  2. Check the wrapped %v error for the exact parse failure and correct the constant used for PluginVersion
  3. Rebuild/redeploy after fixing so initInternal re-fingerprints the plugin

Example fix

// before
info := &base.PluginInfoResponse{Type: base.PluginTypeCSI, PluginApiVersions: []string{"v1"}, PluginVersion: devVersion}
// after
info := &base.PluginInfoResponse{Type: base.PluginTypeCSI, PluginApiVersions: []string{"v1"}, PluginVersion: "1.0.0"}
Defensive patterns

Strategy: validation

Validate before calling

v, err := version.NewVersion(pluginVersion)
if err != nil {
    return fmt.Errorf("PluginVersion %q is not a valid go-version: %w", pluginVersion, err)
}

Try / catch

if err := loader.Init(...); err != nil {
    if strings.Contains(err.Error(), "failed to parse version") {
        // plugin's PluginVersion is malformed; skip or fail fast with details
    }
}

Prevention

When it happens

Trigger: An internal plugin's PluginInfo().PluginVersion is an empty string or a string that is not a valid go-version (e.g. "v1" is fine, but "abc", "1.0.x", or "" fail).

Common situations: Custom/internal plugin reports a hand-written version string that is not semver-compatible; plugin code was modified and PluginVersion left empty; vendor patch changed the constant.

Understand the failure class

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/70518baf92176990. Report an issue: GitHub.