puppetlabs/puppet · error · Puppet::Error

Could not set the dscl #{keyname} key with value: #{value} -

Error message

Could not set the dscl #{keyname} key with value: #{value} - #{detail.inspect}

What it means

Error "Could not set the dscl #{keyname} key with value: #{value} - #{detail.inspect}" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/provider/user/directoryservice.rb:508

  def self.password_hash_dir
    '/var/db/shadow/hash'
  end

  # This method will create a given value using dscl
  def create_attribute_with_dscl(path, username, keyname, value)
    set_attribute_with_dscl('-create', path, username, keyname, value)
  end

  # This method will merge in a given value using dscl
  def merge_attribute_with_dscl(path, username, keyname, value)
    set_attribute_with_dscl('-merge', path, username, keyname, value)
  end

  def set_attribute_with_dscl(dscl_command, path, username, keyname, value)
    dscl '.', dscl_command, "/#{path}/#{username}", keyname, value
  rescue Puppet::ExecutionFailure => detail
    raise Puppet::Error, "Could not set the dscl #{keyname} key with value: #{value} - #{detail.inspect}", detail.backtrace
  end

  # Create the new user with dscl
  def create_new_user(username)
    dscl '.', '-create', "/Users/#{username}"
  end

  # Get the next available uid on the system by getting a list of user ids,
  # sorting them, grabbing the last one, and adding a 1. Scientific stuff here.
  def next_system_id(min_id = 20)
    dscl_output = dscl '.', '-list', '/Users', 'uid'
    # We're ok with throwing away negative uids here. Also, remove nil values.
    user_ids = dscl_output.split.compact.collect { |l| l.to_i if l =~ /^\d+$/ }
    ids = user_ids.compact!.sort_by!(&:to_f)
    # We're just looking for an unused id in our sorted array.
    ids.each_index do |i|
      next_id = ids[i] + 1
      return next_id if ids[i + 1] != next_id and next_id >= min_id

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/provider/user/directoryservice.rb:508 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/9cc2e992db8a2e6a. Report an issue: GitHub.