{"record":{"id":"86144c2ad8f92ab6","repo":"puppetlabs/puppet","slug":"could-not-action-module-name-module-is-no","errorCode":null,"errorMessage":"Could not %{action} '%{module_name}'; module is not installed","messagePattern":"Could not %(.+?) '%(.+?)'; module is not installed","errorType":"exception","errorClass":"Puppet::ModuleTool::Errors::NotInstalledError","httpStatus":null,"severity":"error","filePath":"lib/puppet/module_tool/applications/uninstaller.rb","lineNumber":77,"sourceCode":"              :path => mod.modulepath,\n            }\n            if @options[:version] && mod.version\n              next unless Puppet::Module.parse_range(@options[:version]).include?(SemanticPuppet::Version.parse(mod.version))\n            end\n            @installed << mod\n          elsif mod_name =~ /#{@name}/\n            @suggestions << mod_name\n          end\n        end\n\n        if @installed.length > 1\n          raise MultipleInstalledError,\n                :action => :uninstall,\n                :module_name => @name,\n                :installed_modules => @installed.sort_by { |mod| @environment.modulepath.index(mod.modulepath) }\n        elsif @installed.empty?\n          if @unfiltered.empty?\n            raise NotInstalledError,\n                  :action => :uninstall,\n                  :suggestions => @suggestions,\n                  :module_name => @name\n          else\n            raise NoVersionMatchesError,\n                  :installed_modules => @unfiltered.sort_by { |mod| @environment.modulepath.index(mod[:path]) },\n                  :version_range => @options[:version],\n                  :module_name => @name\n          end\n        end\n      end\n\n      def validate_module\n        mod = @installed.first\n\n        unless @ignore_changes\n          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)\n","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/module_tool/applications/uninstaller.rb#L59-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check what is actually installed: `puppet module list` and match the exact short name.","Fix spelling — compare against the suggestions in the error output.","If the module was installed by r10k, remove it from the Puppetfile and re-run r10k rather than using puppet module uninstall."],"exampleFix":"# before\npuppet module uninstall puppetlabs-stblib\n\n# after\npuppet module uninstall stdlib","handlingStrategy":"validation","validationCode":"found = environment.modules.any? { |m| m.name == @name }\nabort \"#{@name} is not installed\" unless found","typeGuard":null,"tryCatchPattern":"begin\n  Puppet::ModuleTool::Applications::Uninstaller.new(name, options).run\nrescue Puppet::ModuleTool::NotInstalledError => e\n  # e.multiline_options[:suggestions] holds near-miss names\n  exit 0 # idempotent uninstall in automation\nend","preventionTips":["Use the short module name (directory name) for uninstall, not the author slug.","Make uninstall steps idempotent by rescuing NotInstalledError and treating it as success.","For r10k-managed environments, edit the Puppetfile and run r10k instead of manual uninstalls."],"tags":["puppet","module-tool","uninstall","not-installed"],"backgroundTag":"package-not-installed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}