coreybutler/nvm-windows · error
Invalid character(s) found in build meta data %q
Error message
Invalid character(s) found in build meta data %q
What it means
Semver parse error: a dot-separated identifier in the build metadata (the part after '+' in MAJOR.MINOR.PATCH-pre+build) contains characters outside [0-9A-Za-z]. Build identifiers must be alphanumeric per SEMVER 2.0.0; hyphens and other symbols are not allowed there.
Source
Thrown at src/semver/semver.go:277
for _, prstr := range prparts {
parsedPR, err := NewPRVersion(prstr)
if err != nil {
return nil, err
}
v.Pre = append(v.Pre, parsedPR)
}
}
// There is build meta data
if buildIndex != -1 {
buildStr := parts[2][buildIndex+1:]
buildParts := strings.Split(buildStr, ".")
for _, str := range buildParts {
if len(str) == 0 {
return nil, errors.New("Build meta data is empty")
}
if !containsOnly(str, alphanum) {
return nil, fmt.Errorf("Invalid character(s) found in build meta data %q", str)
}
v.Build = append(v.Build, str)
}
}
return v, nil
}
// PreRelease Version
type PRVersion struct {
VersionStr string
VersionNum uint64
IsNum bool
}
// Creates a new valid prerelease version
func NewPRVersion(s string) (*PRVersion, error) {
if len(s) == 0 {View on GitHub (pinned to 5b18223ca1)
Solutions
- Sanitize build metadata to alphanumerics and dots only (replace '_'/'-' with '.')
- Drop the build metadata before parsing — semver precedence ignores it: parse s[:strings.IndexByte(s,'+')]
- Fix the CI job that stamps non-alphanumeric characters into build metadata
Example fix
// before
v, err := semver.NewVersion("1.2.3+linux_x64")
// after
v, err := semver.NewVersion("1.2.3+linux.x64") Defensive patterns
Strategy: validation
Validate before calling
func sanitizeBuild(v string) string {
if i := strings.IndexByte(v, '+'); i >= 0 {
meta := strings.Map(func(r rune) rune {
if (r >= '0' && r <= '9') || (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || r == '.' { return r }
return '.'
}, v[i+1:])
return v[:i+1] + meta
}
return v
} Prevention
- Constrain build metadata to [0-9A-Za-z.] at generation time
- If metadata is irrelevant, drop everything after '+' before parsing
- Encode platform tags with dots (linux.x64) not underscores
When it happens
Trigger: semver.NewVersion("1.2.3+build-1"), "1.2.3+linux_x64", or any '+'-suffix where an identifier between dots contains '_', '-', or other non-alphanumerics.
Common situations: Versions enriched with platform tags using underscores (common from CI build metadata), or build hashes with dashes concatenated into the metadata.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Invalid character(s) found in patch number %q
- Patch number must not contain leading zeroes %q
- Invalid character(s) found in prerelease %q
- Numeric PreRelease version must not contain leading zeroes %
- Unrecognized version: "%s"
AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15).
Data as JSON: /api/errors/194ee65f30ebf372.
Report an issue: GitHub.