pulumi/pulumi · error

Two resources ('%s' and '%s') aliased to the same: '%s'

Error message

Two resources ('%s' and '%s') aliased to the same: '%s'

What it means

Thrown when building the snapshot's alias map: two distinct resources (different URNs) claim the same alias. Duplicate identical aliases on one resource are tolerated, but if the same alias maps to two different resource URNs the snapshot is ambiguous for URN transitions and is rejected.

Source

Thrown at pkg/resource/deploy/snapshot.go:568

// of a resource in the resources map.
//
// Note: This method does not modify the snapshot (and pkgresource.States
// in the snapshot) in-place, but returns an independent structure,
// with minimal copying necessary.
func (snap *Snapshot) NormalizeURNReferences() (*Snapshot, error) {
	if snap == nil {
		return nil, nil
	}

	aliased := make(map[resource.URN]resource.URN)
	for _, state := range snap.Resources {
		// Add to aliased maps
		for _, alias := range state.Aliases {
			// For ease of implementation, some SDKs may end up creating the same alias to the
			// same resource multiple times.  That's fine, only error if we see the same alias,
			// but it maps to *different* resources.
			if otherUrn, has := aliased[alias]; has && otherUrn != state.URN {
				return nil, fmt.Errorf("Two resources ('%s' and '%s') aliased to the same: '%s'", otherUrn, state.URN, alias)
			}
			aliased[alias] = state.URN
		}
		// If our parent has changed URN, then we need to update our URN as well.
		if parent, has := aliased[state.Parent]; has {
			if parent != "" && parent.QualifiedType() != resource.RootStackType {
				aliased[state.URN] = resource.NewURN(
					state.URN.Stack(), state.URN.Project(),
					parent.QualifiedType(), state.URN.Type(),
					state.URN.Name(),
				)
			}
		}
	}

	fixUrn := func(urn resource.URN) resource.URN {
		if newUrn, has := aliased[urn]; has {
			// TODO should this recur to see if newUrn is similarly aliased?

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Identify the two resource URNs and the colliding alias from the error message
  2. Remove the alias from one of the resources in your program (usually keep it only on the intended successor)
  3. Re-run pulumi up; the alias collision is a program/config issue, not state corruption
  4. If a copy was intentional (true duplicate resource), give the new resource a distinct name so its auto-derived aliases differ

Example fix

// before: copied resource keeps same alias
const b2 = new Bucket("b2", {}, { aliases: [{ name: "b" }] }) // collides with b1's alias
// after
const b2 = new Bucket("b2", {}, { aliases: [{ name: "b2-old" }] })
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

if err != nil && strings.Contains(err.Error(), "aliased to the same") {
    // parse the two URNs and alias from the message, remove the alias
    // from the duplicate resource in your program and re-run pulumi up
}

Prevention

When it happens

Trigger: During snapshot verification, state.Aliases contains an alias already recorded for a different URN (aliased[alias] exists and != state.URN); commonly when two resources both alias to one old URN after a rename/copy mistake.

Common situations: Copying a resource declaration (including its aliases list) so both old and new resources declare the same alias; refactoring a resource into two without partitioning aliases; SDK aliasing bugs.

Related errors


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