GoogleContainerTools/skaffold · warning
parsing semver: %w
Error message
parsing semver: %w
What it means
ParseVersion converts Skaffold version strings into a semver.Version, stripping a leading 'v'. If the remaining string is not valid semantic version syntax, the underlying semver.Parse error is wrapped as 'parsing semver'. It is used when checking pre-release versions and the latest available release.
Source
Thrown at pkg/skaffold/version/version.go:94
// UserAgentWithClient returns a conformant value for HTTP `User-Agent` headers that includes
// the client value provided with the `--user` flag. If there is no client value, then the value will be equivalent
// to `UserAgent()`. Otherwise it is of the form `skaffold/<version> (<os>/<arch>) <client>`, and the version
// will be omitted if not available.
// Use UserAgentWithClient method to record requests from skaffold CLI users vs
// other clients.
func UserAgentWithClient() string {
if client == "" {
return UserAgent()
}
return fmt.Sprintf("%s %s", UserAgent(), client)
}
func ParseVersion(version string) (semver.Version, error) {
// Strip the leading 'v' in our version strings
version = strings.TrimSpace(version)
v, err := semver.Parse(strings.TrimLeft(version, "v"))
if err != nil {
return semver.Version{}, fmt.Errorf("parsing semver: %w", err)
}
return v, nil
}
View on GitHub (pinned to a1189de023)
Solutions
- Check the input string with `skaffold version` or the release tag; ensure it is valid semver (MAJOR.MINOR.PATCH)
- Install an official Skaffold release whose `skaffold version` prints proper semver
- Trim stray characters/newlines from version strings before parsing
- If parsing third-party versions, normalize them (pad missing components) before calling ParseVersion
Example fix
// before
ParseVersion("1.39") // parsing semver: ...
// after
ParseVersion("v1.39.2") // OK -> 1.39.2 Defensive patterns
Strategy: validation
Validate before calling
func parseSafe(version string) (semver.Version, error) {
v := strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(version), "v"))
parts := strings.Split(v, ".")
if len(parts) < 3 {
return semver.Version{}, fmt.Errorf("not full semver: %q", version)
}
return version.ParseVersion(version)
} Type guard
func looksLikeSemver(s string) bool {
t := strings.TrimPrefix(strings.TrimSpace(s), "v")
parts := strings.Split(t, ".")
return len(parts) >= 3 && !strings.ContainsAny(t, " \t\n")
} Try / catch
v, err := version.ParseVersion(input)
if err != nil {
// log raw input for inspection; treat as unknown version, skip comparison
} Prevention
- Validate version strings match ^v?\d+\.\d+\.\d+ before parsing
- Install official Skaffold builds so `skaffold version` prints clean semver
- Trim HTTP/response bodies when extracting versions from APIs to avoid HTML leakage
- Pad partial versions to MAJOR.MINOR.PATCH before parsing
When it happens
Trigger: ParseVersion receives a string like '', 'not-a-version', '1.39', 'v1.2.3.4', or output of `skaffold version` / a GitHub release tag that isn't strictly semver (missing patch, extra characters, whitespace-embedded junk).
Common situations: Custom/local builds of Skaffold reporting non-semver version strings (e.g. 'v0.0.0-unknown' variants or git descriptions); proxy/mirror returning an HTML error page where a version JSON was expected; parsing third-party tool versions with looser schemes.
Related errors
- parsing latest version from GCS: %w
- parsing current semver, skipping update check: %w
- parsing manifests file into manifest list object: %w
- parsing image name for registry: %w
- removing unused default args: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/7b09373af81dafd5.
Report an issue: GitHub.