urbanadventurer/WhatWeb · error

You must specify the name of the product

Error message

You must specify the name of the product

What it means

Raised in Version#initialize (lib/version_class.rb:20) when a Version object is constructed without a product name (name_product is nil). The Version class models a product's version history and requires a name, versions list, and URL; all three are validated up front.

Solutions

  1. Pass a non-nil product name string as the first argument to Version.new
  2. Trace why the name is nil at the call site (log the match data feeding Version)
  3. Default or skip: only construct Version when a name was actually matched
  4. Fix argument ordering if the name was accidentally passed in the wrong position

Example fix

# before
Version.new(nil, ['1.0','2.0'], 'https://example.com')
# after
Version.new('MyProduct', ['1.0','2.0'], 'https://example.com')
Defensive patterns

Strategy: validation

Validate before calling

def build_version(name, versions, url)
  return nil if name.nil? || name.to_s.strip.empty?
  Version.new(name, versions, url)
end

Type guard

def valid_version_args?(name, versions, url)
  !name.nil? && !versions.nil? && !url.nil?
end

Try / catch

begin
  v = Version.new(name, versions, url)
rescue RuntimeError => e
  raise unless e.message == 'You must specify the name of the product'
  logger.warn('skipped Version creation: missing product name')
end

Prevention

When it happens

Trigger: Version.new or Version.new(nil, versions, url) — any call site (plugin or internal aggregator) that passes nil for the first argument, e.g. when a plugin failed to extract the product name from a match.

Common situations: Plugin match data missing a name field; refactored plugins calling Version without updating arguments; dynamic construction from parsed data where the name key is absent; typos in keyword/positional argument order.

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


AI-assisted analysis of urbanadventurer/WhatWeb@d279d93042 (2026-09-15). Data as JSON: /api/errors/d990bca3fd3d135f. Report an issue: GitHub.

Appendix: source

Thrown at lib/version_class.rb:20

#
# This file is part of WhatWeb.
#
# 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

View on GitHub (pinned to d279d93042)