pulumi/pulumi · error
version must be provided
Error message
version must be provided
What it means
When converting a pulumi import file's provider parameterization into a provider parameterization, a semantic version is required whenever a parameterized package (p != nil) is being imported. If the version is missing, ToProviderParameterization returns this sentinel error. Parameterized providers cannot be resolved to a plugin without an explicit version.
Source
Thrown at pkg/resource/deploy/import.go:59
type Parameterization struct {
// The base plugin name to use for this parameterization.
PluginName tokens.Package
// The version of the plugin to use for this parameterization.
PluginVersion semver.Version
// The value to use for this parameterization.
Value []byte
}
// ToProviderParameterization converts a workspace parameterization to a provider parameterization.
func (p *Parameterization) ToProviderParameterization(
typ tokens.Type, version *semver.Version,
) (tokens.Package, *semver.Version, *workspace.Parameterization, error) {
if p == nil {
return typ.Package(), version, nil, nil
}
if version == nil {
return "", nil, nil, errors.New("version must be provided")
}
return p.PluginName, &p.PluginVersion, &workspace.Parameterization{
Name: string(typ.Package()),
Version: *version,
Value: p.Value,
}, nil
}
// An Import specifies a resource to import.
type Import struct {
Type tokens.Type // The type token for the resource. Required.
Name string // The name of the resource. Required.
ID resource.ID // The ID of the resource. Required.
Parent resource.URN // The parent of the resource, if any.
Provider resource.URN // The specific provider to use for the resource, if any.
Version *semver.Version // The provider version to use for the resource, if any.
PluginDownloadURL string // The provider PluginDownloadURL to use for the resource, if any.View on GitHub (pinned to 793f7b2e16)
Solutions
- Add the `version` field to the provider entry in the import file
- Regenerate the import file with `pulumi import` so the version is captured
- Use a non-parameterized package reference if no specific version is needed
Example fix
// before (import file)
{"type":"pulumi:providers:aws","name":"aws"}
// after
{"type":"pulumi:providers:aws","name":"aws","version":"6.0.0"} Defensive patterns
Strategy: validation
Validate before calling
if parameterization != nil && version == nil { return errors.New("version must be provided in import file for parameterized package") } Type guard
func hasVersion(imp Import) bool { return imp.Version != nil || imp.Parameterization == nil } Prevention
- Always include `version` in import file provider entries
- Generate import files with the CLI rather than by hand
- Pin provider versions in the program so imports can infer them
When it happens
Trigger: Running `pulumi import` with an import file specifying a parameterized provider entry but omitting the `version` field while the package requires parameterization.
Common situations: Hand-written import files, or generated files for parameterized packages (e.g. bridged multi-version providers) where the version field was dropped.
Understand the failure class
Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.
Related errors
- failed to validate provider config: %w
- provider check failed
- imported provider URN %q is not a provider type
- bind provider schema: %w
- resources file reference %q: get provider version: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/112ddf128bc5fa3c.
Report an issue: GitHub.