{"record":{"id":"7d410b3dadbd8335","repo":"livekit/livekit","slug":"unknown-lat-and-lon-for-the-current-region","errorCode":null,"errorMessage":"unknown lat and lon for the current region","messagePattern":"unknown lat and lon for the current region","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/routing/selector/errors.go","lineNumber":22,"sourceCode":"// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage selector\n\nimport \"errors\"\n\nvar (\n\tErrNoAvailableNodes           = errors.New(\"could not find any available nodes\")\n\tErrCurrentRegionNotSet        = errors.New(\"current region cannot be blank\")\n\tErrCurrentRegionUnknownLatLon = errors.New(\"unknown lat and lon for the current region\")\n\tErrSortByNotSet               = errors.New(\"sort by option cannot be blank\")\n\tErrAlgorithmNotSet            = errors.New(\"node selector algorithm option cannot be blank\")\n\tErrSortByUnknown              = errors.New(\"unknown sort by option\")\n\tErrAlgorithmUnknown           = errors.New(\"unknown node selector algorithm option\")\n)\n","sourceCodeStart":4,"sourceCodeEnd":28,"githubUrl":"https://github.com/livekit/livekit/blob/ee45c3f0b1a83bf4352dbccb6607ebf70b2a5de6/pkg/routing/selector/errors.go#L4-L28","documentation":"ErrCurrentRegionUnknownLatLon is returned by selector.NewRegionAwareSelector when the current region has no config entry (currentRC == nil) while other regions are configured (regionaware.go:58). The selector builds a distance matrix between regions and needs the current region's latitude/longitude; if the current region is absent from the regions list, distances cannot be computed.","triggerScenarios":"Calling NewRegionAwareSelector with a currentRegion name that does not appear in the provided []config.RegionConfig (no lat/lon entry), while len(regions) > 0.","commonSituations":"Typo in the node's region name so it doesn't match any entry in the regions config list; node deployed to a new region that wasn't added to the shared region map; regions list passed from stale config.","solutions":["Add the current region (with correct lat/lon) to the regions configuration so it has an entry","Fix the region name typo/case mismatch between the node config and the regions list","Redeploy/restart the node after updating the region configuration"],"exampleFix":"// before\nregions := []config.RegionConfig{{Name: \"us-east-1\", Latitude: 39.1, Longitude: -77.3}}\nsel, err := selector.NewRegionAwareSelector(\"us-west-2\", regions, sortBy, algo) // unknown region\n// after\nregions := []config.RegionConfig{\n    {Name: \"us-east-1\", Latitude: 39.1, Longitude: -77.3},\n    {Name: \"us-west-2\", Latitude: 45.5, Longitude: -122.6},\n}\nsel, err := selector.NewRegionAwareSelector(\"us-west-2\", regions, sortBy, algo)","handlingStrategy":"validation","validationCode":"var found bool\nfor _, rc := range regions {\n    if rc.Name == currentRegion {\n        found = true\n        break\n    }\n}\nif !found {\n    return nil, fmt.Errorf(\"region %q missing from regions config; add lat/lon entry\", currentRegion)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure every node's region name exactly matches an entry in the shared regions config (watch case/typos)","Add new regions to the shared config before deploying nodes there","Keep region lat/lon data in version-controlled config"],"tags":["selector","configuration","region","latency-routing","livekit"],"backgroundTag":"unknown-region-latlon","analyzedSha":"ee45c3f0b1a83bf4352dbccb6607ebf70b2a5de6","analyzedAt":"2026-09-02T03:56:08.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}