puppetlabs/puppet · error · Puppet::Error

Failed to set owner to

Error message

Failed to set owner to '%{should}': %{detail}

What it means

Posix file provider: File.chown/lchown raised while applying the owner property; the rescue wraps the OS error with the desired owner for reporting.

Solutions

  1. Check the wrapped detail: the owner name may not exist or UID may be invalid
  2. Ensure Puppet runs with sufficient privileges to chown the file
  3. Verify the file path still exists and is not on an unsupported filesystem
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at lib/puppet/provider/file/posix.rb:110 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/ca4eaea56c588f4b. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/provider/file/posix.rb:110

      warning _("Apparently using negative UID (%{currentvalue}) on a platform that does not consistently handle them") % { currentvalue: currentvalue }
      currentvalue = :silly
    end

    currentvalue
  end

  def owner=(should)
    # Set our method appropriately, depending on links.
    if resource[:links] == :manage
      method = :lchown
    else
      method = :chown
    end

    begin
      File.send(method, should, nil, resource[:path])
    rescue => detail
      raise Puppet::Error, _("Failed to set owner to '%{should}': %{detail}") % { should: should, detail: detail }, detail.backtrace
    end
  end

  def group
    stat = resource.stat
    return :absent unless stat

    currentvalue = stat.gid

    # On OS X, files that are owned by -2 get returned as really
    # large GIDs instead of negative ones.  This isn't a Ruby bug,
    # it's an OS X bug, since it shows up in perl, too.
    if currentvalue > Puppet[:maximum_uid].to_i
      warning _("Apparently using negative GID (%{currentvalue}) on a platform that does not consistently handle them") % { currentvalue: currentvalue }
      currentvalue = :silly
    end

    currentvalue

View on GitHub (pinned to e227c27540)