puppetlabs/puppet · error · ArgumentError

Invalid entry at %{error_location}: '%{file_text}'

Error message

Invalid entry at %{error_location}: '%{file_text}'

What it means

Raised by Puppet::FileServing::Configuration::Parser#parse while reading fileserver.conf when a line matches none of the accepted forms: a `[mount_name]` header, a `path <dir>` setting, or an `allow`/`deny` ACL line. The message echoes the offending text plus the exact file:line location (@count tracks the current line number). The exception aborts loading of the whole file-server configuration, so no mounts get served.

Source

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

          raise(ArgumentError, _("Fileserver configuration file does not use '=' as a separator")) if value =~ /^=/

          case var
          when "path"
            path(mount, value)
          when "allow", "deny"
            # ignore `allow *`, otherwise report error
            if var != 'allow' || value != '*'
              error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
              Puppet.err("Entry '#{line.chomp}' is unsupported and will be ignored at #{error_location_str}")
            end
          else
            error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
            raise ArgumentError, _("Invalid argument '%{var}' at %{error_location}") %
                                 { var: var, error_location: error_location_str }
          end
        else
          error_location_str = Puppet::Util::Errors.error_location(@file.filename, @count)
          raise ArgumentError, _("Invalid entry at %{error_location}: '%{file_text}'") %
                               { file_text: line.chomp, error_location: error_location_str }
        end
      end
    end

    validate

    @mounts
  end

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

  def changed?
    @file.changed?
  end

View on GitHub (pinned to e227c27540)

Solutions

  1. Open fileserver.conf at the file:line shown in the error and fix or delete the offending line
  2. Use only the supported grammar: `[mount_name]` headers, `path /absolute/dir` lines (space-separated, no '='), and `allow`/`deny` ACL lines
  3. Re-run `puppet agent --test` (or restart puppetserver) to confirm the config now parses cleanly
  4. Keep fileserver.conf in version control and lint it in CI so bad lines never reach the server

Example fix

# before (fileserver.conf)
mount data /srv/data
allow *.example.com

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

Strategy: validation

Validate before calling

# Lint fileserver.conf before the server loads it
def fileserver_conf_errors(path)
  errors = []
  File.readlines(path).each_with_index do |line, i|
    s = line.strip
    next if s.empty? || s.start_with?('#')
    next if s.match?(/\A\[[A-Za-z0-9_-]+\]\z/)          # mount header
    next if s.match?(/\A(path|allow|deny)\s+\S(?!\s*=)/) # key value (no '=')
    errors << "line #{i + 1}: #{s}"
  end
  errors
end

Try / catch

begin
  mounts = Puppet::FileServing::Configuration::Parser.new(conf).parse
rescue ArgumentError => e
  raise unless e.message.start_with?("Invalid entry")
  log "bad fileserver.conf line: #{e.message}" # e.message contains file:line and text
end

Prevention

When it happens

Trigger: A fileserver.conf line like `mount modules /etc/puppet/modules` (missing brackets), `path=/srv/data` (the parser explicitly rejects '=' as a separator), a stray character line that is not a comment/blank, or an ACL/value line whose shape fails the `\s*(\w+)\s+(.+?)` match (e.g. a single word with no value).

Common situations: Hand-editing fileserver.conf and introducing typos; pasting examples from very old documentation that used different syntax; using '=' between key and value; a path line appearing with trailing junk that breaks the regex.

Related errors


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