{"record":{"id":"9c573b350d24a3ce","repo":"puppetlabs/puppet","slug":"unable-to-find-launchd-plist-for-job-label","errorCode":null,"errorMessage":"Unable to find launchd plist for job: #{label}","messagePattern":"Unable to find launchd plist for job: #(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/service/launchd.rb","lineNumber":175,"sourceCode":"  end\n\n  # Sets a class instance variable with a hash of all launchd plist files that\n  # are found on the system. The key of the hash is the job id and the value\n  # is the path to the file. If a label is passed, we return the job id and\n  # path for that specific job.\n  def self.jobsearch(label = nil)\n    by_label = make_label_to_path_map\n\n    if label\n      if by_label.has_key? label\n        { label => by_label[label] }\n      else\n        # try refreshing the map, in case a plist has been added in the interim\n        by_label = make_label_to_path_map(true)\n        if by_label.has_key? label\n          { label => by_label[label] }\n        else\n          raise Puppet::Error, \"Unable to find launchd plist for job: #{label}\"\n        end\n      end\n    else\n      # caller wants the whole map\n      by_label\n    end\n  end\n\n  # This status method lists out all currently running services.\n  # This hash is returned at the end of the method.\n  def self.job_list\n    @job_list = Hash.new\n    begin\n      output = launchctl :list\n      raise Puppet::Error, \"launchctl list failed to return any data.\" if output.nil?\n\n      output.split(\"\\n\").each do |line|\n        @job_list[line.split(/\\s/).last] = :running","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/service/launchd.rb#L157-L193","documentation":"The launchd provider maps job labels to plist paths by scanning its launchd directories (make_label_to_path_map). jobsearch raises when the requested label is not in the map even after one forced refresh of the map, meaning Puppet can find no plist whose Label key matches the service name. Because launchd identifies jobs by the Label inside the plist (not the filename), a mismatch between resource name and Label is invisible to the lookup.","triggerScenarios":"A service resource whose name is not the exact launchd Job Label (e.g. using a friendly name or filename when Label is com.vendor.agent); a job whose plist has not been installed yet because the shipping package runs after the service resource; plist present in a directory outside launchd_dirs; plist missing a Label key.","commonSituations":"Managing macOS agents on hosts where the label differs from the intuitive name (com.apple.mDNSResponder vs mdns); ordering issues where Package -> Service arrows are missing; third-party daemons dropped in /Library/LaunchDaemons with a Label typo.","solutions":["Get the exact label from the system: launchctl list, or plutil -extract Label json -o - on the plist","Use that exact Label string as the service resource name/title","Ensure the package/file resource that installs the plist is ordered before the service resource","Confirm the plist sits in a directory the provider scans (e.g. /Library/LaunchDaemons, /System/Library/LaunchDaemons)"],"exampleFix":"# before\nservice { 'mdns':\n  ensure   => running,\n  provider => 'launchd',\n}\n\n# after\nservice { 'com.apple.mDNSResponder':\n  ensure   => running,\n  provider => 'launchd',\n}","handlingStrategy":"validation","validationCode":"# the resource name must equal a real launchd Label\nlaunchctl list | awk '{print $3}' | grep -qx \"${label}\" \\\n  || plutil -extract Label json -o - \"/Library/LaunchDaemons/${label}.plist\" 2>/dev/null \\\n  || echo \"no launchd job '${label}' — check Label spelling and ordering\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source macOS service names from launchctl list output (or a fact that caches it), never from filenames","Order File/Package resources that install plists before the launchd service resource","Keep a module-level mapping of friendly names to Labels so manifests stay readable and correct"],"tags":["puppet","launchd","macos","service","plist"],"backgroundTag":"resource-not-found","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}