{"record":{"id":"70518baf92176990","repo":"hashicorp/nomad","slug":"failed-to-parse-version-q-for-internal-plugin-s","errorCode":null,"errorMessage":"failed to parse version %q for internal plugin %s: %v","messagePattern":"failed to parse version %q for internal plugin (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/pluginutils/loader/init.go","lineNumber":134,"sourceCode":"\t\t}\n\n\t\t// Try to retrieve a user specified config\n\t\tif userConfig, ok := configs[k.Name]; ok && userConfig.Config != nil {\n\t\t\tinfo.config = userConfig.Config\n\t\t}\n\n\t\t// Fingerprint base info\n\t\ti, err := base.PluginInfo()\n\t\tif err != nil {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"PluginInfo info failed for internal plugin %s: %v\", k, err))\n\t\t\tcontinue\n\t\t}\n\t\tinfo.baseInfo = i\n\n\t\t// Parse and set the plugin version\n\t\tv, err := version.NewVersion(i.PluginVersion)\n\t\tif err != nil {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"failed to parse version %q for internal plugin %s: %v\", i.PluginVersion, k, err))\n\t\t\tcontinue\n\t\t}\n\t\tinfo.version = v\n\n\t\t// Detect the plugin API version to use\n\t\tav, err := l.selectApiVersion(i)\n\t\tif err != nil {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"failed to validate API versions %v for internal plugin %s: %v\", i.PluginApiVersions, k, err))\n\t\t\tcontinue\n\t\t}\n\t\tif av == \"\" {\n\t\t\tl.logger.Warn(\"skipping plugin because supported API versions for plugin and Nomad do not overlap\", \"plugin\", k)\n\t\t\tcontinue\n\t\t}\n\t\tinfo.apiVersion = av\n\n\t\t// Get the config schema\n\t\tschema, err := base.ConfigSchema()","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/pluginutils/loader/init.go#L116-L152","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Set the plugin's PluginVersion to a valid semver string such as \"1.0.0\" (go-version accepts an optional leading v)","Check the wrapped %v error for the exact parse failure and correct the constant used for PluginVersion","Rebuild/redeploy after fixing so initInternal re-fingerprints the plugin"],"exampleFix":"// before\ninfo := &base.PluginInfoResponse{Type: base.PluginTypeCSI, PluginApiVersions: []string{\"v1\"}, PluginVersion: devVersion}\n// after\ninfo := &base.PluginInfoResponse{Type: base.PluginTypeCSI, PluginApiVersions: []string{\"v1\"}, PluginVersion: \"1.0.0\"}","handlingStrategy":"validation","validationCode":"v, err := version.NewVersion(pluginVersion)\nif err != nil {\n    return fmt.Errorf(\"PluginVersion %q is not a valid go-version: %w\", pluginVersion, err)\n}","typeGuard":null,"tryCatchPattern":"if err := loader.Init(...); err != nil {\n    if strings.Contains(err.Error(), \"failed to parse version\") {\n        // plugin's PluginVersion is malformed; skip or fail fast with details\n    }\n}","preventionTips":["Define PluginVersion as a semver constant, never computed at runtime","Test every plugin's PluginInfo with version.NewVersion in CI","Keep the optional leading \"v\" only; avoid suffixes go-version can't parse"],"tags":["go","plugin-loader","version-parsing","nomad"],"backgroundTag":"invalid-version-string","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}