puppetlabs/puppet · error · ArgumentError

Mounts without paths are not usable

Error message

Mounts without paths are not usable

What it means

At request time, Mount::File#complete_path calls path(node); if the mount never received a `path` line the result is nil, and serving cannot map the client's relative path to a server directory, so ArgumentError is raised. This is the runtime twin of the load-time validate error: it fires when a request actually hits a pathless mount.

Source

Thrown at lib/puppet/file_serving/mount/file.rb:20

require_relative '../../../puppet/file_serving/mount'

class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
  def self.localmap
    @localmap ||= {
      "h" => Puppet.runtime[:facter].value('networking.hostname'),
      "H" => [
        Puppet.runtime[:facter].value('networking.hostname'),
        Puppet.runtime[:facter].value('networking.domain')
      ].join("."),
      "d" => Puppet.runtime[:facter].value('networking.domain')
    }
  end

  def complete_path(relative_path, node)
    full_path = path(node)

    raise ArgumentError, _("Mounts without paths are not usable") unless full_path

    # If there's no relative path name, then we're serving the mount itself.
    return full_path unless relative_path

    file = ::File.join(full_path, relative_path)

    unless Puppet::FileSystem.exist?(file) or Puppet::FileSystem.symlink?(file)
      Puppet.info(_("File does not exist or is not accessible: %{file}") % { file: file })
      return nil
    end

    file
  end

  # Return an instance of the appropriate class.
  def find(short_file, request)
    complete_path(short_file, request.node)
  end

View on GitHub (pinned to e227c27540)

Solutions

  1. Add a `path /srv/data` line under the `[data]` section in fileserver.conf
  2. Reload/restart puppetserver (or wait for the config re-read) so the corrected mount takes effect
  3. Note the load-time 'Mounts without paths are not usable' validation should have caught this: if you see the runtime error instead, check for WatchedFile staleness or code paths that bypass Configuration#validate

Example fix

# before (fileserver.conf)
[data]
  allow *.example.com

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

Strategy: validation

Validate before calling

# Before serving, confirm every mount in fileserver.conf has a path
sections = Hash.new { |h, k| h[k] = {} }
File.readlines(conf).each do |line|
  if (m = line.match(/\A\s*\[([-\w]+)\]/))
    current = m[1]
  elsif current && (p = line.match(/\A\s*path\s+(\S+)/))
    sections[current][:path] = p[1]
  end
end
missing = sections.reject { |_, v| v.key?(:path) }.keys

Try / catch

begin
  mount.complete_path(relative_path, node)
rescue ArgumentError => e
  raise unless e.message == 'Mounts without paths are not usable'
  fail "fileserver.conf mount '#{mount.name}' lacks a path line"
end

Prevention

When it happens

Trigger: A fileserver.conf section like `[data]` containing only allow/deny lines and no `path`, followed by a client requesting `puppet:///data/file.txt`; a path line lost during an edit; expandable paths (%h/%d) that fail to produce a value for the node.

Common situations: Copy-pasted mount skeletons never filled in; config edits that accidentally delete the path line; migrations where the data directory path differs per server and one entry was left blank.

Related errors


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