puppetlabs/puppet · error · Puppet::Error

is an invalid url

Error message

%{value} is an invalid url

What it means

Raised in parse_directive when the `url` directive's value cannot be parsed by URI.parse (URI::InvalidURIError is rescued and re-raised as this Puppet::Error). It means the device URL in the config file is malformed and no device object can be built from it.

Solutions

  1. Correct the url directive to a valid URI, e.g. telnet://host or ssh://host
  2. Check for missing scheme, stray spaces, or illegal characters in the URL
  3. Test the string with URI.parse outside Puppet to confirm validity
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/util/network_device/config.rb:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/6964f3542b60accd. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/util/network_device/config.rb:95

    rescue Errno::EACCES
      Puppet.err _("Configuration error: Cannot read %{file}; cannot serve") % { file: @file }
      # raise Puppet::Error, "Cannot read #{@config}"
    rescue Errno::ENOENT
      Puppet.err _("Configuration error: '%{file}' does not exit; cannot serve") % { file: @file }
    end

    @devices = devices
  end

  def parse_directive(device, var, value, count)
    case var
    when "type"
      device.provider = value
    when "url"
      begin
        URI.parse(value)
      rescue URI::InvalidURIError
        raise Puppet::Error, _("%{value} is an invalid url") % { value: value }
      end
      device.url = value
    when "debug"
      device.options[:debug] = true
    else
      error_location_str = Puppet::Util::Errors.error_location(nil, count)
      raise Puppet::Error, _("Invalid argument '%{var}' at %{error_location}") % { var: var, error_location: error_location_str }
    end
  end
end

View on GitHub (pinned to e227c27540)