pulumi/pulumi · error

invalid name

Error message

invalid %s name %q

What it means

This error comes from `pulumi package info` when parsing a schema member token (resource or function name) in `simplifyModuleName` (pkg/cmd/pulumi/packagecmd/package_info.go:249). Pulumi tokens use the `pkg:module:member` format, e.g. `aws:s3/bucket:Bucket`; a token with fewer than three colon-separated segments cannot be split into package, module, and member parts. The CLI refuses to process such a malformed token rather than silently misattributing it to a module.

Solutions

  1. Check the offending token with `pulumi package info <pkg>` (top-level listing) and identify the malformed key in the schema JSON
  2. Fix the provider/schema so every resource and function token has the `pkg:module:member` form
  3. Regenerate the schema (pulumi-tfgen / provider build) after fixing token generation
  4. If the schema is third-party, report the malformed token to the provider maintainer

Example fix

// malformed token in schema
"aws:Bucket": {...}
// after — full pkg:module:member token
"aws:s3/bucket:Bucket": {...}
Defensive patterns

Strategy: validation

Validate before calling

// before running `pulumi package info --module`
parts := strings.Split(token, ":")
if len(parts) < 3 {
    return fmt.Errorf("token %q must be pkg:module:member", token)
}

Type guard

func isWellFormedToken(name string) bool {
	parts := strings.Split(name, ":")
	return len(parts) == 3 && parts[0] != "" && parts[1] != "" && parts[2] != ""
}

Prevention

When it happens

Trigger: Running `pulumi package info <pkg> --module <m>` against a package schema whose Resources or Functions map contains a key without the `pkg:module:member` shape (fewer than 2 colons). The loop at package_info.go:263-293 calls simplifyModuleName("resource", res) / simplifyModuleName("function", fun) for every key in spec.Resources / spec.Functions.

Common situations: Inspecting a hand-edited, older, or third-party provider schema with nonstandard tokens (e.g. `aws:Bucket` or `bucket` instead of `aws:s3/bucket:Bucket`); schemas generated by tooling that does not follow the Pulumi token convention.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/a9a792feea7b52bc. Report an issue: GitHub.

Appendix: source

Thrown at pkg/cmd/pulumi/packagecmd/package_info.go:249

// writeDescription renders the full schema description below a Description label, inline when it
// fits on one line.
func writeDescription(stdout io.Writer, color colors.Colorization, comment string) {
	description := schemainfo.RenderDescription(comment)
	if description == "" {
		return
	}
	label := schemainfo.Bold(color, "Description")
	if strings.Contains(description, "\n") {
		fmt.Fprintf(stdout, label+":\n%s\n", description)
	} else {
		fmt.Fprintf(stdout, label+": %s\n", description)
	}
}

func simplifyModuleName(typ string, name string) (string, error) {
	split := strings.Split(name, ":")
	if len(split) < 3 {
		return "", fmt.Errorf("invalid %s name %q", typ, name)
	}
	moduleSplit := strings.Split(split[1], "/")
	return split[0] + ":" + moduleSplit[0] + ":" + split[2], nil
}

func showModuleInfo(spec *schema.PackageSpec, moduleName string, stdout io.Writer, color colors.Colorization) error {
	bold := func(s string) string { return schemainfo.Bold(color, s) }
	fmt.Fprintf(stdout, bold("Name")+": %s\n", spec.Name)
	fmt.Fprintf(stdout, bold("Module")+": %s\n", moduleName)
	fmt.Fprintf(stdout, bold("Version")+": %s\n", spec.Version)
	fmt.Fprintf(stdout, bold("Description")+": %s\n", schemainfo.Summarize(spec.Description))

	resources := make(map[string]schema.ResourceSpec)
	for res, spec := range spec.Resources {
		simplifiedName, err := simplifyModuleName("resource", res)
		if err != nil {
			return err
		}

View on GitHub (pinned to 793f7b2e16)