{"record":{"id":"9d876ae259d216bb","repo":"discourse/discourse","slug":"canonical-url-lacks-location-argument","errorCode":null,"errorMessage":"canonical url lacks location argument","messagePattern":"canonical url lacks location argument","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/onebox/engine/google_maps_onebox.rb","lineNumber":131,"sourceCode":"          @placeholder_height = @placeholder_width = 120\n        when :streetview\n          @streetview = true\n          panoid = match[:pano]\n          lon = match[:lon].to_f.to_s\n          lat = match[:lat].to_f.to_s\n          heading = match[:heading].to_f.round(4).to_s\n          pitch = (match[:pitch].to_f / 10.0).round(4).to_s\n          fov = (match[:zoom].to_f / 100.0).round(4).to_s\n          zoom = match[:zoom].to_f.round\n          @url =\n            \"https://www.google.com/maps/embed?pb=!3m2!2sen!4v0!6m8!1m7!1s#{panoid}!2m2!1d#{lon}!2d#{lat}!3f#{heading}!4f#{pitch}!5f#{fov}\"\n          @placeholder =\n            \"https://maps.googleapis.com/maps/api/streetview?size=690x400&location=#{lon},#{lat}&pano=#{panoid}&fov=#{zoom}&heading=#{heading}&pitch=#{pitch}&sensor=false\"\n        when :canonical\n          query = URI.decode_www_form(uri.query).to_h\n          if !query.has_key?(\"ll\")\n            unless query.has_key?(\"sll\")\n              raise ArgumentError, \"canonical url lacks location argument\"\n            end\n            query[\"ll\"] = query[\"sll\"]\n            @url += \"&ll=#{query[\"sll\"]}\"\n          end\n          location = query[\"ll\"]\n          if !query.has_key?(\"z\")\n            unless query.has_key?(\"spn\") || query.has_key?(\"sspn\")\n              raise ArgumentError, \"canonical url has incomplete query arguments\"\n            end\n            if !query.has_key?(\"spn\")\n              query[\"spn\"] = query[\"sspn\"]\n              @url += \"&spn=#{query[\"sspn\"]}\"\n            end\n            angle = query[\"spn\"].split(\",\").first.to_f\n            zoom = (Math.log(690.0 * 360.0 / angle / 256.0) / Math.log(2)).round\n          else\n            zoom = query[\"z\"]\n          end","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/discourse/discourse/blob/1b2d7253e854205d2c95c80b2c6a1cdd42e45059/lib/onebox/engine/google_maps_onebox.rb#L113-L149","documentation":"Error \"canonical url lacks location argument\" thrown in discourse/discourse.","triggerScenarios":"Thrown at lib/onebox/engine/google_maps_onebox.rb:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b2d7253e854205d2c95c80b2c6a1cdd42e45059","analyzedAt":"2026-08-26T03:11:08.302Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}