{"record":{"id":"2e5924aafed107c7","repo":"hashicorp/nomad","slug":"error-v","errorCode":null,"errorMessage":"error: %v","messagePattern":"error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/operator_debug.go","lineNumber":2118,"sourceCode":"\t\t}\n\t}\n\n\tif nodeID != \"\" {\n\t\tfor _, node := range c.nodes {\n\t\t\tif node.ID == nodeID {\n\t\t\t\tversion = node.Version\n\t\t\t}\n\t\t}\n\t}\n\n\treturn version\n}\n\n// checkVersion verifies that version satisfies the constraint\nfunc checkVersion(version string, versionConstraint string) error {\n\tv, err := goversion.NewVersion(version)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error: %v\", err)\n\t}\n\n\tc, err := goversion.NewConstraint(versionConstraint)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error: %v\", err)\n\t}\n\n\tif !c.Check(v) {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unsupported version=%s matches version filter %s\", version, minimumVersionPprofConstraint)\n}\n","sourceCodeStart":2100,"sourceCodeEnd":2131,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/operator_debug.go#L2100-L2131","documentation":"checkVersion wraps failures from goversion.NewVersion(version) with the generic message \"error: %v\". This happens when the version string being checked (the server agent version during `nomad operator debug` pprof collection) cannot be parsed as a valid semantic-ish version.","triggerScenarios":"Calling checkVersion with a version string that hashicorp/go-version cannot parse, e.g. an empty string, \"unknown\", or a non-numeric build label.","commonSituations":"A Nomad server reporting an unexpected/empty version string, a proxy or mock endpoint returning a placeholder version, or testing checkVersion directly with malformed input.","solutions":["Verify the server actually reports a parseable version (e.g. via `nomad version` or /v1/agent/self).","Fix the input string so it conforms to a version format like 1.2.3 (optionally with prerelease/metadata).","If the agent version is genuinely unparseable, upgrade the agent or skip pprof collection for that node."],"exampleFix":"// before\nerr := checkVersion(\"unknown\", \">= 0.9.1\")\n// after\nv := strings.TrimSpace(agentVersion)\nif v == \"\" || v == \"unknown\" { /* skip pprof */ }\nerr := checkVersion(v, \">= 0.9.1\")","handlingStrategy":"validation","validationCode":"if _, err := goversion.NewVersion(strings.TrimSpace(agentVersion)); err != nil {\n    // skip pprof / reject input before calling checkVersion\n}","typeGuard":null,"tryCatchPattern":"if err := checkVersion(v, constraint); err != nil {\n    log.Printf(\"version check skipped: %v\", err)\n}","preventionTips":["Sanitize the version string (trim whitespace, reject placeholders like 'unknown') before checking.","Confirm the server returns a real version via /v1/agent/self before relying on it.","Keep agents reasonably up to date so version strings are well-formed."],"tags":["versioning","parsing","nomad"],"backgroundTag":"version-parse-error","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"}