pulumi/pulumi · error
load package for token %s: %w
Error message
load package for token %s: %w
What it means
Interpreter.lookupResource resolves a PCL resource token (pkg:module:type) to a schema resource. It first loads the package via i.loader.LoadPackageReferenceV2 using the package descriptor; if loading fails, it returns "load package for token %s: %w". This means the provider package's schema could not be fetched, parsed, or parameterized — not that the specific resource is missing.
Source
Thrown at pkg/pcl/runtime/interpreter.go:721
}
return outputs, nil
}
func (i *Interpreter) lookupResource(ctx context.Context, token string) (*schema.Resource, error) {
pkg, mod, typ, diags := pcl.DecomposeToken(token, hcl.Range{})
contract.Assertf(!diags.HasErrors(), "invalid token format for resource token %s", token)
token = fmt.Sprintf("%s:%s:%s", pkg, mod, typ)
pkgName := pkg
if pkg == "pulumi" && mod == "providers" {
pkgName = typ
}
descriptor := i.lookupPackageDescriptor(pkgName)
pkgref, err := i.loader.LoadPackageReferenceV2(ctx, descriptor)
if err != nil {
return nil, fmt.Errorf("load package for token %s: %w", token, err)
}
if pkg == "pulumi" && mod == "providers" {
return pkgref.Provider()
}
resources := pkgref.Resources()
schemaResource, ok, err := resources.Get(token)
if err != nil {
return nil, fmt.Errorf("get resource from package for token %s: %w", token, err)
}
if !ok {
return nil, fmt.Errorf("get resource from package for token %s", token)
}
return schemaResource, nil
}
func (i *Interpreter) lookupFunction(ctx context.Context, token string) (*schema.Function, error) {
pkg, mod, typ, diags := pcl.DecomposeToken(token, hcl.Range{})
contract.Assertf(!diags.HasErrors(), "invalid token format for function token %s", token)View on GitHub (pinned to 793f7b2e16)
Solutions
- Check the wrapped error for the actual load failure (download, parse, version)
- Run `pulumi plugin install resource <pkg> <version>` to warm the local schema cache
- Verify the package name and version in the PCL import / PackageDescriptors are correct and published
- If parameterized, confirm the Parameterization name/version/value match the base package schema
- Check network/proxy access to the provider's schema download URL
Example fix
// before: import referencing a nonexistent version
import * as aws from "@pulumi/aws"; // version 99.0.0 in descriptor
// after: pin a published version
// PackageDescriptor: { Name: "aws", Version: semver.MustParse("6.0.0") } Defensive patterns
Strategy: validation
Validate before calling
// pre-flight: ensure the package schema can be loaded before running the program
_, err := loader.LoadPackageReferenceV2(ctx, &schema.PackageDescriptor{Name: pkg, Version: ver})
if err != nil {
return fmt.Errorf("pre-flight schema load for %s failed: %w", pkg, err)
} Try / catch
res, err := interp.Run(ctx, program)
if err != nil && strings.Contains(err.Error(), "load package for token") {
// retry after warming the plugin cache, or report a schema-availability problem
return fmt.Errorf("provider schema unavailable: %w", err)
} Prevention
- Run `pulumi plugin install resource <pkg> <version>` before executing interpreted programs
- Pin only published provider versions in PackageDescriptors
- Validate parameterization values against the base package schema
- Check network/proxy access to schema download URLs in CI
When it happens
Trigger: registerResource → lookupResource with a token whose package cannot be loaded: schema download fails (no network/bad plugin cache), the package version does not exist, or a parameterized package descriptor is invalid.
Common situations: Offline execution without a cached provider schema; specifying a plugin version that was never published; corrupted ~/.pulumi/plugins schema cache; typo in the package name in the PCL import; parameterized provider (e.g. kubernetes) with bad parameterization value.
Related errors
- convert call arguments: %w
- property %q: %w
- array index %d: %w
- map key %q: %w
- cannot convert to any type in union: %v
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/024167f74d280285.
Report an issue: GitHub.