{"record":{"id":"d990bca3fd3d135f","repo":"urbanadventurer/WhatWeb","slug":"you-must-specify-the-name-of-the-product","errorCode":null,"errorMessage":"You must specify the name of the product","messagePattern":"You must specify the name of the product","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/version_class.rb","lineNumber":20,"sourceCode":"#\n# This file is part of WhatWeb.\n#\n# WhatWeb is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 2 of the License, or\n# at your option) any later version.\n#\n# WhatWeb is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with WhatWeb.  If not, see <http://www.gnu.org/licenses/>.\n\nclass Version\n  def initialize(name_product = nil, versions = nil, url = nil)\n    raise 'You must specify the name of the product' if name_product.nil?\n    raise 'You must specify the available versions of the product' if versions.nil?\n    raise 'You must specify the available url of the website' if url.nil?\n\n    @name = name_product\n    @versions = versions\n    @files = Hash['filenames' => [], 'files' => [], 'md5' => []]\n    @url = url\n    @got_best_versions = false\n    @best_versions = []\n\n    versions.each do |version|\n      version[1].each do |file|\n        next if @files['filenames'].include? file[0]\n        @files['filenames'].push(file[0])\n        @files['files'].push(URI.join(@url.to_s, file[0]).to_s)\n        _status, url, _ip, body, _headers = open_target(@files['files'].last)\n        @files['md5'].push(Digest::MD5.hexdigest(body))\n      end","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/urbanadventurer/WhatWeb/blob/d279d93042d034f3fd29d5a893d44ccc0595d3f8/lib/version_class.rb#L2-L38","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass a non-nil product name string as the first argument to Version.new","Trace why the name is nil at the call site (log the match data feeding Version)","Default or skip: only construct Version when a name was actually matched","Fix argument ordering if the name was accidentally passed in the wrong position"],"exampleFix":"# before\nVersion.new(nil, ['1.0','2.0'], 'https://example.com')\n# after\nVersion.new('MyProduct', ['1.0','2.0'], 'https://example.com')","handlingStrategy":"validation","validationCode":"def build_version(name, versions, url)\n  return nil if name.nil? || name.to_s.strip.empty?\n  Version.new(name, versions, url)\nend","typeGuard":"def valid_version_args?(name, versions, url)\n  !name.nil? && !versions.nil? && !url.nil?\nend","tryCatchPattern":"begin\n  v = Version.new(name, versions, url)\nrescue RuntimeError => e\n  raise unless e.message == 'You must specify the name of the product'\n  logger.warn('skipped Version creation: missing product name')\nend","preventionTips":["Guard name presence before constructing Version objects","Only instantiate Version after a successful product-name match in plugins","Log match data when the name key is missing to catch plugin regressions","Keep argument order (name, versions, url) consistent at all call sites"],"tags":["argument-validation","constructor","version-class"],"backgroundTag":"missing-required-argument","analyzedSha":"d279d93042d034f3fd29d5a893d44ccc0595d3f8","analyzedAt":"2026-09-15T13:51:42.453Z","contentChangedAt":"2026-09-15T13:51:42.453Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}