urbanadventurer/WhatWeb · error
You must specify the available url of the website
Error message
You must specify the available url of the website
What it means
Version#initialize requires a non-nil URL of the website hosting version-specific files. When the `url` argument is nil (or omitted), the constructor raises this error. Without a URL the Version object cannot fetch the files whose checksums are compared to fingerprint the product version.
Solutions
- Pass a valid website URL as the third argument to Version.new
- Ensure the target URL string is non-nil before constructing the Version (parse the target first and fall back to a known base URL)
- Check argument order: initialize(name_product, versions, url)
- Build the Version only after a target URL has been successfully resolved
Example fix
// before
v = Version.new('Apache', ['2.4.57'], nil)
// after
v = Version.new('Apache', ['2.4.57'], 'http://example.com/') Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError, 'url is required' if url.nil? || url.to_s.strip.empty?
v = Version.new('Apache', ['2.4.57'], url) Type guard
def valid_url?(u) u.is_a?(String) && !u.strip.empty? end
Prevention
- Resolve the target URL before building a Version object
- Never pass positional args blindly — name, versions, url order matters
- Default to the scanned target's base URL when no explicit URL exists
- Validate URL non-nil and non-empty upstream
When it happens
Trigger: Calling Version.new(name, versions, nil), Version.new(name, versions) with the third positional argument omitted, or passing a nil variable (e.g. a target whose host extraction failed) as the url argument.
Common situations: Scripted WhatWeb usage where the matched target URL was not propagated into the Version constructor; refactors that changed from keyword-style to positional arguments dropping the url; nil propagation from failed target parsing upstream.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- You must specify the available versions of the product
- No target
- Error parsing target IP range: #
- Unable to parse invalid target. No hostname.
- You must specify the name of the product
AI-assisted analysis of urbanadventurer/WhatWeb@d279d93042 (2026-09-15).
Data as JSON: /api/errors/ac78e9591a90846e.
Report an issue: GitHub.
Appendix: source
Thrown at lib/version_class.rb:22
#
# WhatWeb is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# at your option) any later version.
#
# WhatWeb is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WhatWeb. If not, see <http://www.gnu.org/licenses/>.
class Version
def initialize(name_product = nil, versions = nil, url = nil)
raise 'You must specify the name of the product' if name_product.nil?
raise 'You must specify the available versions of the product' if versions.nil?
raise 'You must specify the available url of the website' if url.nil?
@name = name_product
@versions = versions
@files = Hash['filenames' => [], 'files' => [], 'md5' => []]
@url = url
@got_best_versions = false
@best_versions = []
versions.each do |version|
version[1].each do |file|
next if @files['filenames'].include? file[0]
@files['filenames'].push(file[0])
@files['files'].push(URI.join(@url.to_s, file[0]).to_s)
_status, url, _ip, body, _headers = open_target(@files['files'].last)
@files['md5'].push(Digest::MD5.hexdigest(body))
end
end
endView on GitHub (pinned to d279d93042)