puppetlabs/puppet · error · Puppet::ModuleTool::Errors::NotInstalledError

Could not %{action} '%{module_name}'; module is not installe

Error message

Could not %{action} '%{module_name}'; module is not installed

What it means

Uninstaller raises Puppet::ModuleTool::NotInstalledError when @installed is empty and @unfiltered is also empty — no directory on any modulepath matches the requested module name at all. The error carries @suggestions (module names partially matching /#{name}/) so the CLI can print 'did you mean' hints.

Source

Thrown at lib/puppet/module_tool/applications/uninstaller.rb:77

              :path => mod.modulepath,
            }
            if @options[:version] && mod.version
              next unless Puppet::Module.parse_range(@options[:version]).include?(SemanticPuppet::Version.parse(mod.version))
            end
            @installed << mod
          elsif mod_name =~ /#{@name}/
            @suggestions << mod_name
          end
        end

        if @installed.length > 1
          raise MultipleInstalledError,
                :action => :uninstall,
                :module_name => @name,
                :installed_modules => @installed.sort_by { |mod| @environment.modulepath.index(mod.modulepath) }
        elsif @installed.empty?
          if @unfiltered.empty?
            raise NotInstalledError,
                  :action => :uninstall,
                  :suggestions => @suggestions,
                  :module_name => @name
          else
            raise NoVersionMatchesError,
                  :installed_modules => @unfiltered.sort_by { |mod| @environment.modulepath.index(mod[:path]) },
                  :version_range => @options[:version],
                  :module_name => @name
          end
        end
      end

      def validate_module
        mod = @installed.first

        unless @ignore_changes
          raise _("Either the `--ignore_changes` or `--force` argument must be specified to uninstall modules when running in FIPS mode.") if Puppet.runtime[:facter].value(:fips_enabled)

View on GitHub (pinned to e227c27540)

Solutions

  1. Check what is actually installed: `puppet module list` and match the exact short name.
  2. Fix spelling — compare against the suggestions in the error output.
  3. If the module was installed by r10k, remove it from the Puppetfile and re-run r10k rather than using puppet module uninstall.

Example fix

# before
puppet module uninstall puppetlabs-stblib

# after
puppet module uninstall stdlib
Defensive patterns

Strategy: validation

Validate before calling

found = environment.modules.any? { |m| m.name == @name }
abort "#{@name} is not installed" unless found

Try / catch

begin
  Puppet::ModuleTool::Applications::Uninstaller.new(name, options).run
rescue Puppet::ModuleTool::NotInstalledError => e
  # e.multiline_options[:suggestions] holds near-miss names
  exit 0 # idempotent uninstall in automation
end

Prevention

When it happens

Trigger: Running `puppet module uninstall stdlib` when no stdlib directory exists on any modulepath; misspelling the name ('stdilb'); uninstalling a module managed by r10k/Puppetfile where the directory uses a different short name.

Common situations: Typos in module names; assuming a module is installed because a manifest uses it; environments managed by r10k where modules live under .modules or temp dirs; module already removed by another admin.

Related errors


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