{"record":{"id":"e5c0a0c15444ba6a","repo":"puppetlabs/puppet","slug":"could-not-uninstall-module-name-no-installed","errorCode":null,"errorMessage":"Could not uninstall '%{module_name}'; no installed version matches","messagePattern":"Could not uninstall '%(.+?)'; no installed version matches","errorType":"exception","errorClass":"Puppet::ModuleTool::Errors::NoVersionMatchesError","httpStatus":null,"severity":"error","filePath":"lib/puppet/module_tool/applications/uninstaller.rb","lineNumber":82,"sourceCode":"            @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\n          changes = begin\n            Puppet::ModuleTool::Applications::Checksummer.run(mod.path)\n          rescue ArgumentError\n            []\n          end","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/module_tool/applications/uninstaller.rb#L64-L100","documentation":"Uninstaller raises Puppet::ModuleTool::NoVersionMatchesError when @installed is empty but @unfiltered is not: directories with the matching module name exist, yet none of their versions falls inside the --version range given. The error lists the unfiltered installed modules and the version_range so the user can see which versions are present versus requested.","triggerScenarios":"Running `puppet module uninstall stdlib --version '>= 5.0.0'` when the installed stdlib is 4.25.1 — the name matched (module went into @unfiltered) but the version filter excluded it from @installed, leaving @installed empty while @unfiltered has entries.","commonSituations":"Version ranges written against an outdated expectation of what is deployed; metadata.json of the installed module edited so its version no longer matches reality; scripts parameterized with module versions that drifted across environments.","solutions":["Check the actual installed version with `puppet module list` and adjust the --version range to include it.","Omit --version entirely to uninstall regardless of version.","If the installed version in metadata.json is wrong, fix it or uninstall without a version filter."],"exampleFix":"# before\npuppet module uninstall stdlib --version '>= 5.0.0'   # installed: 4.25.1\n\n# after\npuppet module uninstall stdlib --version '4.25.1'\n# or simply: puppet module uninstall stdlib","handlingStrategy":"validation","validationCode":"mod = environment.modules.find { |m| m.name == @name }\nif mod && options[:version]\n  range = Puppet::Module.parse_range(options[:version])\n  abort \"installed #{mod.version} outside #{options[:version]}\" unless range.include?(SemanticPuppet::Version.parse(mod.version))\nend","typeGuard":null,"tryCatchPattern":"begin\n  uninstaller.run\nrescue Puppet::ModuleTool::NoVersionMatchesError => e\n  opts = e.multiline_options # :installed_modules, :version_range\n  retry_without_version_filter(opts)\nend","preventionTips":["Query the installed version (`puppet module list`) before passing --version to uninstall.","Omit --version when any installed version should be removed.","Keep deployed module versions in sync with automation inventory to avoid stale version pins."],"tags":["puppet","module-tool","uninstall","version-conflict"],"backgroundTag":"package-version-not-matched","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}