Newer Version Available

This content describes an older version of this product. View Latest

Avoid Namespace Collisions in Second-Generation Managed Packages

Namespaces impact the combination of package types you can install in an org.

When sharing a namespace, be intentional about managing component names across packages within that namespace. Ensure that packages associated with the same namespace don’t include components with the same API name. If two packages include a component with the same API name, you can’t install these packages into the same org.

Important

To understand how namespaces affect the types of packages you can install in a namespaced or no-namespace org, review this table.

Installation Org No-namespace Unlocked Package Namespaced Unlocked Package Second-generation Managed Package (2GP) First-generation Managed Package (1GP)
Org with a namespace

For example, a 1GP packaging org, 1GP patch org, Developer Edition org with namespace, or a scratch org with namespace

Fail.

You can’t install a no-namespace unlocked package in an org with a namespace.

Pass.

Regardless of whether the namespace matches or is different from the org’s namespace, you can install one or many namespaced unlocked packages.

Pass.

Regardless of whether the namespace matches or is different from the org’s namespace, you can install one or many 2GP packages.

Pass.

If the namespace of the 1GP is different from the namespace of the org, you can install one or many packages.

Fail.

If the namespace of the 1GP is the same as the namespace of the org, you can’t install the 1GP into the org.

Org without a namespace Pass.

You can install one or many no-namespace unlocked packages.

Pass.

You can install one or many namespaced unlocked packages.

Pass.

You can install one or many 2GP packages.

Pass.

You can install one or many 1GP packages.

To understand how namespaces affect the combination of packages that can be installed into one org, review this table.

Namespace and Package Type Unlocked Package with Namespace Y Second-generation Managed Package (2GP) with Namespace Y First-generation Managed Package (1GP) with Namespace Y
First-generation Managed Package (1GP) with namespace X Pass.

If the 1GP and unlocked package use unique namespaces, you can install them in the same org.

Pass.

If the 1GP and 2GP use unique namespaces, you can install them in the same org.

Pass.

If each 1GP uses a unique namespace, you can install multiple 1GP packages in the same org.

First-generation Managed Package (1GP) with namespace Y Fail.

If the 1GP and unlocked package share a namespace, you can’t install them in the same org.

Fail.

If the 1GP and 2GP share a namespace, you can’t install them in the same org.

Fail.

If the 1GP packages share a namespace, you can’t install them in the same org.

Second-generation Managed Package (2GP) with namespace X Pass.

You can install a 2GP and a namespaced unlocked package in the same org. The packages can share a namespace or use unique namespaces.

Pass.

You can install multiple 2GP packages with unique namespaces, or the same namespace.

Pass.

If the 1GP and 2GP use unique namespaces, you can install them in the same org.

Second-generation Managed Package (2GP) with namespace Y Pass.

You can install a 2GP and a namespaced unlocked package in the same org. The packages can share a namespace or use unique namespaces.

Pass.

You can install multiple 2GP packages with the same namespace in the same org.

Fail.

If the 1GP and 2GP share a namespace, you can’t install them in the same org.