TechnitiumSoftware/DnsServer · error · DnsServerException

The zone '<memberZoneInfo.DisplayName>' is already a member

Error message

The zone '<memberZoneInfo.DisplayName>' is already a member of Catalog zone '<currentCatalogZoneName>'.

What it means

Thrown by AddCatalogMemberZone when a zone is already associated with a Catalog zone. The guard reads memberZoneInfo.ApexZone.CatalogZoneName and, when it is non-null and validation is enabled, refuses to add the zone to another catalog because a member zone may belong to only one catalog at a time.

Source

Thrown at DnsServerCore/Dns/ZoneManagers/AuthZoneManager.cs:1787

        }

        #endregion

        #region catalog member zones

        public void AddCatalogMemberZone(string catalogZoneName, AuthZoneInfo memberZoneInfo, bool ignoreValidationErrors = false)
        {
            switch (memberZoneInfo.Type)
            {
                case AuthZoneType.Primary:
                case AuthZoneType.Secondary:
                case AuthZoneType.Stub:
                case AuthZoneType.Forwarder:
                    if (!ignoreValidationErrors)
                    {
                        string currentCatalogZoneName = memberZoneInfo.ApexZone.CatalogZoneName;
                        if (currentCatalogZoneName is not null)
                            throw new DnsServerException("The zone '" + memberZoneInfo.DisplayName + "' is already a member of Catalog zone '" + currentCatalogZoneName + "'.");
                    }

                    ApexZone apexZone = _root.GetApexZone(catalogZoneName);
                    if (apexZone is not CatalogZone catalogZone)
                    {
                        if (ignoreValidationErrors)
                            return;

                        throw new DnsServerException("No such Catalog zone was found: " + catalogZoneName);
                    }

                    //set catalog zone name in member zone so that properties can be set below correctly
                    memberZoneInfo.ApexZone.CatalogZoneName = catalogZone.Name;

                    if (!memberZoneInfo.Disabled)
                    {
                        catalogZone.AddMemberZone(memberZoneInfo.Name, memberZoneInfo.Type);

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Call RemoveCatalogMemberZone(memberZoneInfo) first to detach from the current catalog, then add to the new one.
  2. To move between catalogs, use ChangeCatalogMemberZoneOwnership which handles the transfer atomically.
  3. If re-adding to the same catalog is intended, skip the add when CatalogZoneName already equals catalogZoneName.
  4. Refresh memberZoneInfo before calling so the check reflects live state.

Example fix

// before
manager.AddCatalogMemberZone(catalogName, memberZone); // throws if already a member

// after
if (!string.IsNullOrEmpty(memberZone.ApexZone.CatalogZoneName))
    manager.ChangeCatalogMemberZoneOwnership(memberZone, catalogName);
else
    manager.AddCatalogMemberZone(catalogName, memberZone);
Defensive patterns

Strategy: validation

Validate before calling

if (!string.IsNullOrEmpty(memberZone.ApexZone.CatalogZoneName) && memberZone.ApexZone.CatalogZoneName != catalogName)
    return Conflict($"Zone is already a member of '{memberZone.ApexZone.CatalogZoneName}'.");

Try / catch

catch (DnsServerException ex) when (ex.Message.Contains("already a member")) { return Conflict(ex.Message); }

Prevention

When it happens

Trigger: Calling AddCatalogMemberZone(catalogZoneName, memberZoneInfo) where memberZoneInfo.ApexZone.CatalogZoneName is already set (zone is a member of some catalog) and ignoreValidationErrors is false (the default).

Common situations: Re-adding a zone to the same or a different catalog without first removing it. UI not refreshing the zone's catalog membership status. Bulk-import script that re-applies catalog membership.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/00cdd7c6a5395062. Report an issue: GitHub.