{"record":{"id":"6f4ec5f022a41ef9","repo":"puppetlabs/puppet","slug":"could-not-action-module-name-module-is-no-6f4ec5","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/upgrader.rb","lineNumber":48,"sourceCode":"        # Disallow anything that invokes md5 to avoid un-friendly termination due to FIPS\n        raise _(\"Module upgrade is prohibited in FIPS mode.\") if Puppet.runtime[:facter].value(:fips_enabled)\n\n        name = @name.tr('/', '-')\n        version = options[:version] || '>= 0.0.0'\n\n        results = {\n          :action => :upgrade,\n          :requested_version => options[:version] || :latest,\n        }\n\n        begin\n          all_modules = @environment.modules_by_path.values.flatten\n          matching_modules = all_modules.select do |x|\n            x.forge_name && x.forge_name.tr('/', '-') == name\n          end\n\n          if matching_modules.empty?\n            raise NotInstalledError, results.merge(:module_name => name)\n          elsif matching_modules.length > 1\n            raise MultipleInstalledError, results.merge(:module_name => name, :installed_modules => matching_modules)\n          end\n\n          installed_release = installed_modules[name]\n\n          # `priority` is an attribute of a `SemanticPuppet::Dependency::Source`,\n          # which is delegated through `ModuleRelease` instances for the sake of\n          # comparison (sorting). By default, the `InstalledModules` source has\n          # a priority of 10 (making it the most preferable source, so that\n          # already installed versions of modules are selected in preference to\n          # modules from e.g. the Forge). Since we are specifically looking to\n          # upgrade this module, we don't want the installed version of this\n          # module to be chosen in preference to those with higher versions.\n          #\n          # This implementation is suboptimal, and since we can expect this sort\n          # of behavior to be reasonably common in Semantic, we should probably\n          # see about implementing a `ModuleRelease#override_priority` method","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/module_tool/applications/upgrader.rb#L30-L66","documentation":"Raised by the Upgrader as Puppet::ModuleTool::Errors::NotInstalledError when `puppet module upgrade <name>` finds no installed module to upgrade. The upgrader flattens environment.modules_by_path and matches candidates by forge_name translated to dash form; an empty match set means the module name is not present in any directory of the active modulepath.","triggerScenarios":"Running `puppet module upgrade <author-module>` when no installed module's forge_name matches, e.g. wrong namespace (puppetlabs-apt vs puppet-apt), a typo, or the module living in a different environment/modulepath than the one Puppet is using.","commonSituations":"Forgetting the author namespace or mistyping the slug; --environment or --modulepath flags pointing elsewhere; module installed under $basemodulepath instead of the environment's modulepath; assuming `upgrade` also installs (it does not).","solutions":["Run `puppet module list` to see the exact installed names, then upgrade using the listed forge name","If it is genuinely absent, install it first: `puppet module install <author-module>`","Check you are targeting the right environment: `puppet module upgrade <name> --environment <env>` or pass the correct --modulepath","Watch for the uninstaller/upgrader suggestion output, which lists similarly named installed modules"],"exampleFix":"# before\n$ puppet module upgrade apt   # not namespaced\n# Error: Could not upgrade 'apt'; module is not installed\n\n# after\n$ puppet module list | grep apt\n  puppetlabs-apt (v8.4.0)\n$ puppet module upgrade puppetlabs-apt","handlingStrategy":"validation","validationCode":"installed = env.modules_by_path.values.flatten\n  .select { |m| m.forge_name && m.forge_name.tr('/', '-') == name }\nabort \"#{name} is not installed in this environment — use `puppet module install`\" if installed.empty?","typeGuard":null,"tryCatchPattern":"result = Puppet::ModuleTool::Applications::Upgrader.new(name, options).run\nif result[:error] && result[:error][:oneline] =~ /module is not installed/\n  Puppet::ModuleTool::Applications::Installer.new(name, options).run  # install instead\nend","preventionTips":["Always `puppet module list` to copy the exact namespaced slug before upgrading","Pin the correct --environment/--modulepath in automation to avoid searching the wrong tree","Remember `upgrade` never installs; branch your scripts on presence first"],"tags":["puppet","module-tool","upgrade","not-installed","modulepath"],"backgroundTag":"module-not-installed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}