puppetlabs/puppet · error · ArgumentError

TypeSet '# ' references a TypeSet using alias '# '. The…

Error message

TypeSet '#{@name}' references a TypeSet using alias '#{ref_alias}'. The alias collides with the name of a declared type

What it means

A TypeSet reference was given an alias that is identical to the name of a type already declared in the same TypeSet; the alias map (ref_map) would be ambiguous, so construction aborts.

Solutions

  1. Rename the reference alias so it differs from every declared type name in the TypeSet
  2. Rename the colliding declared type if the alias name is the intended one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/pops/types/p_type_set_type.rb:160 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/8c79a7e6081febf4. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/pops/types/p_type_set_type.rb:160

        ref_na = ref.name_authority || @name_authority
        na_roots = root_map[ref_na]

        ranges = na_roots[ref_name]
        if ranges.nil?
          na_roots[ref_name] = [ref.version_range]
        else
          unless ranges.all? { |range| (range & ref.version_range).nil? }
            raise ArgumentError, "TypeSet '#{@name}' references TypeSet '#{ref_na}/#{ref_name}' more than once using overlapping version ranges"
          end

          ranges << ref.version_range
        end

        if ref_map.has_key?(ref_alias)
          raise ArgumentError, "TypeSet '#{@name}' references a TypeSet using alias '#{ref_alias}' more than once"
        end
        if @types.has_key?(ref_alias)
          raise ArgumentError, "TypeSet '#{@name}' references a TypeSet using alias '#{ref_alias}'. The alias collides with the name of a declared type"
        end

        ref_map[ref_alias] = ref

        @dc_to_cc_map[ref_alias.downcase] = ref_alias
        ref_map[ref_alias] = ref
      end
      @references = ref_map.freeze
    end
    @dc_to_cc_map.freeze
    init_annotatable(init_hash)
  end

  # Produce a hash suitable for the initializer
  # @return [Hash{String => Object}] the initialization hash
  #
  # @api private
  def _pcore_init_hash

View on GitHub (pinned to e227c27540)