puppetlabs/puppet · error · ArgumentError

%{mount} is already mounted at %{name} at %{error_location}

Error message

%{mount} is already mounted at %{name} at %{error_location}

What it means

Raised by Puppet::FileServing::Configuration::Parser#newmount when a second `[name]` section appears for a mount name that is already in @mounts. Because mounts are keyed by name, a redefinition would silently shadow the first section's paths and ACLs, so the parser rejects it with the previous mount object and the location of the duplicate line.

Source

Thrown at lib/puppet/file_serving/configuration/parser.rb:76

    @mounts
  end

  def initialize(filename)
    @file = Puppet::Util::WatchedFile.new(filename)
  end

  def changed?
    @file.changed?
  end

  private

  # Create a new mount.
  def newmount(name)
    if @mounts.include?(name)
      error_location_str = Puppet::Util::Errors.error_location(@file, @count)
      raise ArgumentError, _("%{mount} is already mounted at %{name} at %{error_location}") %
                           { mount: @mounts[name], name: name, error_location: error_location_str }
    end
    case name
    when "modules"
      mount = Mount::Modules.new(name)
    when "plugins"
      mount = Mount::Plugins.new(name)
    when "scripts"
      mount = Mount::Scripts.new(name)
    when "tasks"
      mount = Mount::Tasks.new(name)
    when "locales"
      mount = Mount::Locales.new(name)
    else
      mount = Mount::File.new(name)
    end
    @mounts[name] = mount
    mount

View on GitHub (pinned to e227c27540)

Solutions

  1. Search fileserver.conf for repeated `[<name>]` headers and merge the two sections into one, combining their path and allow/deny lines
  2. If the duplicate is accidental, delete the later section
  3. If the two sections really serve different directories, rename one header to a unique mount name and update the `puppet:///<new-name>/...` URIs that reference it

Example fix

# before (fileserver.conf)
[data]
  path /srv/data
  allow *
[data]
  path /srv/other
  allow *.example.com

# after
[data]
  path /srv/data
  allow *
[data2]
  path /srv/other
  allow *.example.com
Defensive patterns

Strategy: validation

Validate before calling

def duplicate_mounts?(path)
  seen = Hash.new(0)
  File.readlines(path).each do |line|
    m = line.match(/\A\s*\[([-\w]+)\]/)
    seen[m[1]] += 1 if m
  end
  seen.select { |_, n| n > 1 }.keys
end

Try / catch

begin
  parser.parse
rescue ArgumentError => e
  raise unless e.message.include?('is already mounted')
  # e.message names the duplicate mount; merge/remove sections and retry
end

Prevention

When it happens

Trigger: Two `[modules]` or `[data]` sections in one fileserver.conf; concatenating two config fragments that both define the same mount (e.g. both define `[plugins]`); re-adding a section at the bottom of the file while forgetting one exists earlier.

Common situations: Config managed by multiple people or multiple automation tools appending sections; copy-paste of an example block without renaming the header; merging environments after a server consolidation.

Related errors


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