{"record":{"id":"c346f49d9ac5c4de","repo":"OrchardCMS/OrchardCore","slug":"invalid-geo-point-representation","errorCode":null,"errorMessage":"Invalid geo point representation","messagePattern":"Invalid geo point representation","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/OrchardCore/OrchardCore.Lucene.Core/QueryProviders/Filters/GeoDistanceFilterProvider.cs","lineNumber":204,"sourceCode":"                if (!geoPointValue.ContainsKey(\"lon\") || !geoPointValue.ContainsKey(\"lat\"))\n                {\n                    return false;\n                }\n\n                point = new Point(geoPointValue[\"lon\"].Value<double>(), geoPointValue[\"lat\"].Value<double>(), ctx);\n                return true;\n            case JsonValueKind.Array:\n                var geoArrayValue = geoToken.AsArray();\n\n                if (geoArrayValue.Count != 2)\n                {\n                    return false;\n                }\n\n                point = new Point(geoArrayValue[0].Value<double>(), geoArrayValue[1].Value<double>(), ctx);\n\n                return true;\n            default: throw new ArgumentException(\"Invalid geo point representation\");\n        }\n    }\n\n    [GeneratedRegex(@\"^((\\d+(\\.\\d*)?)|(\\.\\d+))\")]\n    private static partial Regex StringDistanceRegex();\n}\n","sourceCodeStart":186,"sourceCodeEnd":211,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore/OrchardCore.Lucene.Core/QueryProviders/Filters/GeoDistanceFilterProvider.cs#L186-L211","documentation":"TryGetPointFromJToken accepts a geo point as either an object with latitude/longitude (or lat/lon) properties, or a two-element numeric array [lon, lat]. Any other representation hits the default case and throws 'Invalid geo point representation'.","triggerScenarios":"Passing a point as a string like \"lat,lon\", a single number, an object missing lat/lon keys, or an array with non-numeric/incorrect-length values that fall through.","commonSituations":"Copying geo_point syntax from Elasticsearch (which also accepts strings and geo hash), or mistyping latitude/Longitude property names.","solutions":["Use the supported forms: {\"latitude\":52.1,\"longitude\":4.9} (or lat/lon) or [4.9, 52.1].","Ensure the array has exactly two numeric elements in [longitude, latitude] order.","Remove string ('lat,lon') or geo-hash point encodings, which are not supported."],"exampleFix":"// before\n{\"geo_distance\":{\"distance\":\"10km\",\"location\":\"52.1,4.9\"}}\n// after\n{\"geo_distance\":{\"distance\":\"10km\",\"location\":{\"latitude\":52.1,\"longitude\":4.9}}}","handlingStrategy":"validation","validationCode":"bool IsValidPoint(JsonNode? p) =>\n    p is JsonObject o && (o.ContainsKey(\"latitude\") || o.ContainsKey(\"lat\"))\n    || p is JsonArray a && a.Count == 2 && a.All(x => x is JsonValue);\nif (!IsValidPoint(node)) throw new ArgumentException(\"Geo point must be {latitude,longitude} or [lon,lat].\");","typeGuard":"static bool IsGeoPoint(JsonNode? n) => n is JsonObject o && (o.ContainsKey(\"latitude\") || o.ContainsKey(\"lat\")) || n is JsonArray { Count: 2 };","tryCatchPattern":"try { var q = geoProvider.CreateFilteredQuery(builder, ctx, name, node); }\ncatch (ArgumentException ex) when (ex.Message == \"Invalid geo point representation\") { /* normalize and retry */ }","preventionTips":["Only use {latitude, longitude} objects or [lon, lat] numeric arrays.","Do not send 'lat,lon' strings or geo hashes; normalize them before querying."],"tags":["lucene","query-dsl","geo"],"backgroundTag":"invalid-argument-format","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}