puppetlabs/puppet · error · ArgumentError
Not a valid full name: %{full_module_name}
Error message
Not a valid full name: %{full_module_name} What it means
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.
Source
Thrown at lib/puppet/module_tool.rb:40
# TODO: Rename this method to reflect its purpose?
# TODO: Shouldn't this be used when building packages too?
def self.artifact?(path)
case File.basename(path)
when *ARTIFACTS
true
else
false
end
end
# Return the +username+ and +modname+ for a given +full_module_name+, or raise an
# ArgumentError if the argument isn't parseable.
def self.username_and_modname_from(full_module_name)
matcher = full_module_name.match(FULL_MODULE_NAME_PATTERN)
if matcher
matcher.captures
else
raise ArgumentError, _("Not a valid full name: %{full_module_name}") % { full_module_name: full_module_name }
end
end
# Find the module root when given a path by checking each directory up from
# its current location until it finds one that satisfies is_module_root?
#
# @param path [Pathname, String] path to start from
# @return [Pathname, nil] the root path of the module directory or nil if
# we cannot find one
def self.find_module_root(path)
path = Pathname.new(path) if path.instance_of?(String)
path.expand_path.ascend do |p|
return p if is_module_root?(p)
end
nil
endView on GitHub (pinned to e227c27540)
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.
Example fix
# before
Puppet::ModuleTool.username_and_modname_from('stdlib')
# after
Puppet::ModuleTool.username_and_modname_from('puppetlabs-stdlib') Defensive patterns
Strategy: validation
Validate before calling
FULL = /\A([^-/|.]+)[-|\/](.+)\z/ def valid_full_name?(s) !FULL.match(s).nil? end author, name = Puppet::ModuleTool.username_and_modname_from(slug) if valid_full_name?(slug)
Type guard
def forge_slug?(s) s.is_a?(String) && s.match?(\A[^-/|.]+[-\/]([^\s]+)\z) end
Try / catch
begin
author, modname = Puppet::ModuleTool.username_and_modname_from(input)
rescue ArgumentError => e
abort "expected 'author-modulename', got: #{input}"
end Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not determine module path
- Could not %{action} '%{module_name}', did you mean '%{sugges
- Could not %{action} '%{module_name}'; %{error}
- Could not find a valid module at %{path}
- Please provide a file or checksum to diff with
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/e2268eb4b5cfd8d0.
Report an issue: GitHub.