discourse/discourse · error · ArgumentError
canonical url lacks location argument
Error message
canonical url lacks location argument
What it means
Error "canonical url lacks location argument" thrown in discourse/discourse.
Source
Thrown at lib/onebox/engine/google_maps_onebox.rb:131
@placeholder_height = @placeholder_width = 120
when :streetview
@streetview = true
panoid = match[:pano]
lon = match[:lon].to_f.to_s
lat = match[:lat].to_f.to_s
heading = match[:heading].to_f.round(4).to_s
pitch = (match[:pitch].to_f / 10.0).round(4).to_s
fov = (match[:zoom].to_f / 100.0).round(4).to_s
zoom = match[:zoom].to_f.round
@url =
"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}"
@placeholder =
"https://maps.googleapis.com/maps/api/streetview?size=690x400&location=#{lon},#{lat}&pano=#{panoid}&fov=#{zoom}&heading=#{heading}&pitch=#{pitch}&sensor=false"
when :canonical
query = URI.decode_www_form(uri.query).to_h
if !query.has_key?("ll")
unless query.has_key?("sll")
raise ArgumentError, "canonical url lacks location argument"
end
query["ll"] = query["sll"]
@url += "&ll=#{query["sll"]}"
end
location = query["ll"]
if !query.has_key?("z")
unless query.has_key?("spn") || query.has_key?("sspn")
raise ArgumentError, "canonical url has incomplete query arguments"
end
if !query.has_key?("spn")
query["spn"] = query["sspn"]
@url += "&spn=#{query["sspn"]}"
end
angle = query["spn"].split(",").first.to_f
zoom = (Math.log(690.0 * 360.0 / angle / 256.0) / Math.log(2)).round
else
zoom = query["z"]
endView on GitHub (pinned to 1b2d7253e8)
When it happens
Trigger: Thrown at lib/onebox/engine/google_maps_onebox.rb:131 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26).
Data as JSON: /api/errors/9d876ae259d216bb.
Report an issue: GitHub.