{"record":{"id":"e2268eb4b5cfd8d0","repo":"puppetlabs/puppet","slug":"not-a-valid-full-name-full-module-name","errorCode":null,"errorMessage":"Not a valid full name: %{full_module_name}","messagePattern":"Not a valid full name: %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/module_tool.rb","lineNumber":40,"sourceCode":"    # TODO: Rename this method to reflect its purpose?\n    # TODO: Shouldn't this be used when building packages too?\n    def self.artifact?(path)\n      case File.basename(path)\n      when *ARTIFACTS\n        true\n      else\n        false\n      end\n    end\n\n    # Return the +username+ and +modname+ for a given +full_module_name+, or raise an\n    # ArgumentError if the argument isn't parseable.\n    def self.username_and_modname_from(full_module_name)\n      matcher = full_module_name.match(FULL_MODULE_NAME_PATTERN)\n      if matcher\n        matcher.captures\n      else\n        raise ArgumentError, _(\"Not a valid full name: %{full_module_name}\") % { full_module_name: full_module_name }\n      end\n    end\n\n    # Find the module root when given a path by checking each directory up from\n    # its current location until it finds one that satisfies is_module_root?\n    #\n    # @param path [Pathname, String] path to start from\n    # @return [Pathname, nil] the root path of the module directory or nil if\n    #   we cannot find one\n    def self.find_module_root(path)\n      path = Pathname.new(path) if path.instance_of?(String)\n\n      path.expand_path.ascend do |p|\n        return p if is_module_root?(p)\n      end\n\n      nil\n    end","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/module_tool.rb#L22-L58","documentation":"Puppet::ModuleTool.username_and_modname_from raises ArgumentError when the argument does not match FULL_MODULE_NAME_PATTERN = /\\A([^-/|.]+)[-|\\/](.+)\\z/, i.e. it must be 'author-modulename' or 'author/modulename' with a non-empty author segment before a single '-' or '/'. Callers use this to split a Forge slug into username and module name; anything without a separator, or starting with the separator, is rejected.","triggerScenarios":"Calling Puppet::ModuleTool.username_and_modname_from('stdlib') (no author), '-stdlib', 'puppetlabs/stdlib/extra' (extra segment is captured but author 'puppetlabs' works — only separator-less or empty-author strings fail), '.hidden-mod', or accidentally passing a version like 'puppetlabs-stdlib-1.0.0' still matches but 'stdlib-1.0.0' style misuse without hyphen fails. Any string lacking '-' or '/' or whose left side is empty raises.","commonSituations":"Scripts that pass a bare module name where a full 'author-module' slug is expected; user input not validated before calling ModuleTool install/build helpers; environment variables or Rakefile arguments containing only the short name.","solutions":["Pass the full namespaced slug: 'puppetlabs-stdlib' or 'puppetlabs/stdlib' instead of 'stdlib'.","If you only have a short name, prefix the Forge owner explicitly (e.g. \"#{owner}-#{name}\").","Validate input against /\\A[^-/|.]+[-\\/]([^-/|.]+)\\z/ before calling the API.","Rescue ArgumentError locally and re-prompt for a correctly formatted name."],"exampleFix":"# before\nPuppet::ModuleTool.username_and_modname_from('stdlib')\n\n# after\nPuppet::ModuleTool.username_and_modname_from('puppetlabs-stdlib')","handlingStrategy":"validation","validationCode":"FULL = /\\A([^-/|.]+)[-|\\/](.+)\\z/\n\ndef valid_full_name?(s)\n  !FULL.match(s).nil?\nend\n\nauthor, name = Puppet::ModuleTool.username_and_modname_from(slug) if valid_full_name?(slug)","typeGuard":"def forge_slug?(s)\n  s.is_a?(String) && s.match?(\\A[^-/|.]+[-\\/]([^\\s]+)\\z)\nend","tryCatchPattern":"begin\n  author, modname = Puppet::ModuleTool.username_and_modname_from(input)\nrescue ArgumentError => e\n  abort \"expected 'author-modulename', got: #{input}\"\nend","preventionTips":["Always pass the full 'author-module' slug in scripts and Puppetfiles.","Validate user-supplied slugs against the pattern before calling ModuleTool APIs.","Wrap the call and re-prompt on ArgumentError in interactive tools."],"tags":["puppet","module-tool","argument-validation","forge-slug"],"backgroundTag":"invalid-module-name","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}