pulumi/pulumi · error
invalid version %q in package schema: %w
Error message
invalid version %q in package schema: %w
What it means
The schema's version string failed semver parsing. Run() validates pkg.Version with semver.Parse before publishing and wraps the parse error in this message with %q showing the offending value.
Source
Thrown at pkg/cmd/pulumi/packagecmd/package_publish.go:231
publisher, err = b.GetDefaultOrg(ctx)
if err != nil {
return fmt.Errorf("failed to determine default organization: %w", err)
}
if publisher == "" {
return errors.New("no publisher specified and no default organization found, please set a publisher in " +
"the package schema or set a default organization in your pulumi config")
}
}
name := pkg.Name
if name == "" {
return errors.New("no package name specified, please set one in the package schema")
}
var version semver.Version
if pkg.Version != "" {
version, err = semver.Parse(pkg.Version)
if err != nil {
return fmt.Errorf("invalid version %q in package schema: %w", pkg.Version, err)
}
} else {
return errors.New("no version specified, please set a version in the package schema")
}
jsonData, err := json.Marshal(pkg)
if err != nil {
return fmt.Errorf("failed to marshal schema: %w", err)
}
registry, err := b.GetCloudRegistry()
if err != nil {
return fmt.Errorf("failed to get the Private Registry backend: %w", err)
}
// We need to set the content-size header for S3 puts. For byte buffers (or deterministic readers)
// the stdlib http client does that automatically. For os.File it cannot do that because the size
// returned by Stat() is not reliable:View on GitHub (pinned to 793f7b2e16)
Solutions
- Fix the version in the schema to a valid semver string like 1.0.0 (MAJOR.MINOR.PATCH, optional -prerelease)
- Check the wrapped error (%w) for the exact parse failure position
- If the version comes from a build script, correct the script's template
Example fix
// before (schema.json)
{ "version": "1.0" }
// after
{ "version": "1.0.0" } Defensive patterns
Strategy: validation
Validate before calling
if _, err := semver.Parse(schema.Version); err != nil {
return fmt.Errorf("schema version %q is not valid semver: %v", schema.Version, err)
} Prevention
- Use automated versioning (git tag -> semver) instead of hand-editing
- Strip leading "v" from tags before writing into the schema
- Test-parse versions in CI before publishing
When it happens
Trigger: `pulumi package publish` with a schema whose `version` field is not valid semantic versioning, e.g. "1.0", "v1.0.0" with a prefix semver rejects, "1.0.0-beta bad", or containing whitespace/garbage.
Common situations: Hand-edited schema versions missing a component ("1.0"); build tooling writing "v"-prefixed tags into the schema; placeholder versions like "dev" or "latest" left in the schema.
Related errors
- resources file reference %q: get provider version: %w
- unmarshaling deployment: %w
- no package name specified, please set one in the package sch
- no version specified, please set a version in the package sc
- failed to create table %s: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/dcfd88ff3b71ed5f.
Report an issue: GitHub.