{"record":{"id":"ac78e9591a90846e","repo":"urbanadventurer/WhatWeb","slug":"you-must-specify-the-available-url-of-the-website","errorCode":null,"errorMessage":"You must specify the available url of the website","messagePattern":"You must specify the available url of the website","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/version_class.rb","lineNumber":22,"sourceCode":"#\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\n  end","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/urbanadventurer/WhatWeb/blob/d279d93042d034f3fd29d5a893d44ccc0595d3f8/lib/version_class.rb#L4-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nv = Version.new('Apache', ['2.4.57'], nil)\n// after\nv = Version.new('Apache', ['2.4.57'], 'http://example.com/')","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'url is required' if url.nil? || url.to_s.strip.empty?\nv = Version.new('Apache', ['2.4.57'], url)","typeGuard":"def valid_url?(u)\n  u.is_a?(String) && !u.strip.empty?\nend","tryCatchPattern":null,"preventionTips":["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"],"tags":["ruby","constructor","whatweb","missing-argument","url"],"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"}