{"record":{"id":"3508a19c06b7b10b","repo":"urbanadventurer/WhatWeb","slug":"you-must-specify-the-available-versions-of-the-product","errorCode":null,"errorMessage":"You must specify the available versions of the product","messagePattern":"You must specify the available versions of the product","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/version_class.rb","lineNumber":21,"sourceCode":"# 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\n    end","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/urbanadventurer/WhatWeb/blob/d279d93042d034f3fd29d5a893d44ccc0595d3f8/lib/version_class.rb#L3-L39","documentation":"Version#initialize in WhatWeb's version_class.rb requires a product name, an available-versions value, and a URL. When the `versions` argument is nil (or omitted), the constructor raises this error before any instance state is set. It is a guard against creating a Version object that has no version data to compare or download against.","triggerScenarios":"Calling Version.new(name, nil, url) or Version.new(name, url: ...) with the second positional argument omitted, or passing a variable that evaluated to nil (e.g. an empty lookup result used as the versions argument).","commonSituations":"Plugins or helper scripts construct a Version to fetch version-specific files after a match, but the versions list was never populated because an earlier scrape/regex found nothing; positional-argument mix-ups where url is passed as the second argument leaving versions nil.","solutions":["Pass a non-nil versions value as the second argument to Version.new, e.g. an array or string of versions","Check the variable feeding the versions argument for nil before constructing the Version","Verify argument order: initialize(name_product, versions, url) — ensure url was not shifted into the versions slot","Default to an empty-but-non-nil structure like [] if the caller intentionally has no known versions"],"exampleFix":"// before\nv = Version.new('Apache', nil, 'http://example.com')\n// after\nv = Version.new('Apache', ['2.4.57', '2.4.58'], 'http://example.com')","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'versions is required' if versions.nil?\nv = Version.new('Apache', versions, 'http://example.com')","typeGuard":"def valid_versions?(v)\n  !v.nil?\nend","tryCatchPattern":null,"preventionTips":["Check all three constructor arguments for nil before calling Version.new","Remember argument order: name, versions, url","Treat empty lookup results as [] rather than nil","Unit-test plugin constructors with nil arguments"],"tags":["ruby","constructor","whatweb","missing-argument"],"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"}