pulumi/pulumi · error

alias can specify Parent, ParentURN or NoParent but not more

Error message

alias can specify Parent, ParentURN or NoParent but not more then one

What it means

Alias options let you specify an alias's parent in three mutually exclusive ways: Parent (a resource input), ParentURN (a URN input), or NoParent (explicitly opt out). AliasSpec validation via multipleTrue enforces that at most one of these fields is set; setting two or more returns this error instead of guessing which parent applies.

Source

Thrown at sdk/go/pulumi/alias.go:83

	if a.URN != nil {
		return a.URN.ToURNOutput(), nil
	}

	n := a.Name
	if n == nil {
		n = String(defaultName)
	}
	t := a.Type
	if t == nil {
		t = String(defaultType)
	}

	var parent StringInput = String("")
	if defaultParent != nil {
		parent = defaultParent.URN().ToStringOutput()
	}
	if multipleTrue(a.Parent != nil, a.ParentURN != nil, a.NoParent != nil) {
		return URNOutput{}, errors.New("alias can specify Parent, ParentURN or NoParent but not more then one")
	}
	if a.Parent != nil {
		parent = a.Parent.URN().ToStringOutput()
	}
	if a.ParentURN != nil {
		parent = a.ParentURN.ToURNOutput()
	}
	if a.NoParent != nil {
		parent = All(a.NoParent.ToBoolOutput(), parent).ApplyT(func(a []any) string {
			if a[0].(bool) {
				return ""
			}
			return a[1].(string)
		}).(StringOutput)
	}

	project := a.Project
	if project == nil {

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Keep exactly one parent field set: choose Parent, ParentURN, or NoParent and delete the others
  2. If parent comes from configuration, validate/select one before constructing the Alias
  3. Use NoParent only when you explicitly want the alias to have no parent, and never combine it with a parent value

Example fix

// before
alias := pulumi.Alias{Parent: parent, NoParent: pulumi.Bool(true)}

// after
alias := pulumi.Alias{Parent: parent}
Defensive patterns

Strategy: validation

Validate before calling

func validAlias(a pulumi.Alias) bool {
	set := 0
	if a.Parent != nil {
		set++
	}
	if a.ParentURN != nil {
		set++
	}
	if a.NoParent != nil {
		set++
	}
	return set <= 1
}

Prevention

When it happens

Trigger: Calling pulumi.Alias{Parent: x, ParentURN: y}, pulumi.Alias{NoParent: pulumi.Bool(true), Parent: x}, or constructing an Alias from config/user input where multiple parent fields got populated simultaneously.

Common situations: Migrating code from the old Alias{URN: ...} style where defaults were merged with explicit parents; merging alias config from multiple sources; typo where Parent was set while NoParent remained true.

Related errors


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