hashicorp/nomad · error

error: %v

Error message

error: %v

What it means

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.

Source

Thrown at command/operator_debug.go:2118

		}
	}

	if nodeID != "" {
		for _, node := range c.nodes {
			if node.ID == nodeID {
				version = node.Version
			}
		}
	}

	return version
}

// checkVersion verifies that version satisfies the constraint
func checkVersion(version string, versionConstraint string) error {
	v, err := goversion.NewVersion(version)
	if err != nil {
		return fmt.Errorf("error: %v", err)
	}

	c, err := goversion.NewConstraint(versionConstraint)
	if err != nil {
		return fmt.Errorf("error: %v", err)
	}

	if !c.Check(v) {
		return nil
	}
	return fmt.Errorf("unsupported version=%s matches version filter %s", version, minimumVersionPprofConstraint)
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the server actually reports a parseable version (e.g. via `nomad version` or /v1/agent/self).
  2. Fix the input string so it conforms to a version format like 1.2.3 (optionally with prerelease/metadata).
  3. If the agent version is genuinely unparseable, upgrade the agent or skip pprof collection for that node.

Example fix

// before
err := checkVersion("unknown", ">= 0.9.1")
// after
v := strings.TrimSpace(agentVersion)
if v == "" || v == "unknown" { /* skip pprof */ }
err := checkVersion(v, ">= 0.9.1")
Defensive patterns

Strategy: validation

Validate before calling

if _, err := goversion.NewVersion(strings.TrimSpace(agentVersion)); err != nil {
    // skip pprof / reject input before calling checkVersion
}

Try / catch

if err := checkVersion(v, constraint); err != nil {
    log.Printf("version check skipped: %v", err)
}

Prevention

When it happens

Trigger: Calling checkVersion with a version string that hashicorp/go-version cannot parse, e.g. an empty string, "unknown", or a non-numeric build label.

Common situations: 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.

Related errors


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