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
- Identify the two resource URNs and the colliding alias from the error message
- Remove the alias from one of the resources in your program (usually keep it only on the intended successor)
- Re-run pulumi up; the alias collision is a program/config issue, not state corruption
- 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
- Never copy a resource declaration without removing or renaming its aliases
- Give each aliased resource exactly one alias chain to its predecessor
- Search your program for the colliding alias string when refactoring resources
- Prefer explicit unique aliases per resource over shared list literals
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
- two resources ('%s' and '%s') have the same alias: '%s'
- resource serialization failed; illegal markup extension: '%v
- %s: snapshot integrity failure; it was already written, but
- serializing deployment: %w
- snapshot integrity failure; refusing to use it: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/6922e5481e2d4bbc.
Report an issue: GitHub.