puppetlabs/puppet · error · Puppet::Error
Cannot write the user's crontab: The user does not exist
Error message
Cannot write the %{path} user's crontab: The user does not exist What it means
Raised by the crontab filetype's write method (lib/puppet/util/filetype.rb:233) before attempting any write: Puppet::Util.uid(@path) returned nil, meaning the target user does not exist on the system. Unlike read (which treats a missing user as an empty crontab), write aborts because there is no user whose crontab could be replaced.
Solutions
- Create the user %{path} (e.g. via a puppet user resource) before managing its crontab.
- Fix the target/username typo in the cron resource so it names an existing user.
- Ensure the resource dependency order guarantees the user is managed before the cron entries.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/puppet/util/filetype.rb:233 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/6cb3b42afc34644a.
Report an issue: GitHub.
Appendix: source
Thrown at lib/puppet/util/filetype.rb:233
# Remove a specific @path's cron tab.
def remove
cmd = "#{cmdbase} -r"
if %w[Darwin FreeBSD DragonFly].include?(Puppet.runtime[:facter].value('os.name'))
cmd = "/bin/echo yes | #{cmd}"
end
Puppet::Util::Execution.execute(cmd, failonfail: true, combine: true)
end
# Overwrite a specific @path's cron tab; must be passed the @path name
# and the text with which to create the cron tab.
#
# TODO: We should refactor this at some point to make it identical to the
# :aixtab and :suntab's write methods so that, at the very least, the pipe
# is not created and the crontab command's errors are not swallowed.
def write(text)
unless Puppet::Util.uid(@path)
raise Puppet::Error, _("Cannot write the %{path} user's crontab: The user does not exist") % { path: @path }
end
# this file is managed by the OS and should be using system encoding
IO.popen("#{cmdbase()} -", "w", :encoding => Encoding.default_external) { |p|
p.print text
}
end
private
# Only add the -u flag when the @path is different. Fedora apparently
# does not think I should be allowed to set the @path to my own user name
def cmdbase
if @uid == Puppet::Util::SUIDManager.uid || Puppet.runtime[:facter].value('os.name') == "HP-UX"
"crontab"
else
"crontab -u #{@path}"
endView on GitHub (pinned to e227c27540)