mapbox / mapbox/mapbox-gl-geocoder
error: query must be an array with 2 items
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 388
- Forks
- 181
- PR merge metrics
- No merged PRs in 30d
Description
Using reverse coding if there is a space at the beginning or end of coordinates throws this error.
Solution: Trim whitespaces on input


The same thing happens on the example page. https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-geocoder-accept-coordinates/
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reverse-coordinate search with leading and trailing spaces on the linked Mapbox GL JS example page, then trace the coordinate-query input handling in the plugin. Done means whitespace around valid coordinates no longer causes the “query must be an array with 2 items” error and the example behaves correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100