puppetlabs/puppet · error · ArgumentError

The same flag can only be used once, got '#{fmt}'

Error message

The same flag can only be used once, got '#{fmt}'

What it means

Error "The same flag can only be used once, got '#{fmt}'" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/types/string_converter.rb:117

      :space => ['', '']
    }.freeze

    def initialize(fmt)
      @orig_fmt = fmt
      match = FMT_PATTERN.match(fmt)
      unless match
        raise ArgumentError, "The format '#{fmt}' is not a valid format on the form '%<flags><width>.<prec><format>'"
      end

      @format = match[4]
      unless @format.is_a?(String) && @format.length == 1
        raise ArgumentError, "The format must be a one letter format specifier, got '#{@format}'"
      end

      @format = @format.to_sym
      flags  = match[1].split('') || []
      unless flags.uniq.size == flags.size
        raise ArgumentError, "The same flag can only be used once, got '#{fmt}'"
      end

      @left  = flags.include?('-')
      @alt   = flags.include?('#')
      @plus  = if flags.include?(' ')
                 :space
               else
                 flags.include?('+') ? :plus : :ignore
               end
      @zero_pad = flags.include?('0')

      @delimiters = nil
      DELIMITERS.each do |d|
        next unless flags.include?(d)
        unless @delimiters.nil?
          raise ArgumentError, "Only one of the delimiters [ { ( < | can be given in the format flags, got '#{fmt}'"
        end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/types/string_converter.rb:117 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/aea07a1ffd62634f. Report an issue: GitHub.