{"record":{"id":"d74e0a9f09764f70","repo":"weaviate/weaviate","slug":"valuegeorange-field-distance-must-be-set","errorCode":null,"errorMessage":"valueGeoRange: field 'distance' must be set","messagePattern":"valueGeoRange: field 'distance' must be set","errorType":"validation","errorClass":null,"httpStatus":422,"severity":"error","filePath":"adapters/handlers/rest/filterext/parse_value.go","lineNumber":146,"sourceCode":"\t\treturn valueFilter(in.ValueDateArray, schema.DataTypeDate), nil\n\t},\n\t// boolean\n\tfunc(in *models.WhereFilter) (*filters.Value, error) {\n\t\tif len(in.ValueBooleanArray) == 0 {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\treturn valueFilter(in.ValueBooleanArray, schema.DataTypeBoolean), nil\n\t},\n\n\t// geo range\n\tfunc(in *models.WhereFilter) (*filters.Value, error) {\n\t\tif in.ValueGeoRange == nil {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\tif in.ValueGeoRange.Distance == nil {\n\t\t\treturn nil, fmt.Errorf(\"valueGeoRange: field 'distance' must be set\")\n\t\t}\n\n\t\tif in.ValueGeoRange.Distance.Max < 0 {\n\t\t\treturn nil, fmt.Errorf(\"valueGeoRange: field 'distance.max' must be a positive number\")\n\t\t}\n\n\t\tif in.ValueGeoRange.GeoCoordinates == nil {\n\t\t\treturn nil, fmt.Errorf(\"valueGeoRange: field 'geoCoordinates' must be set\")\n\t\t}\n\n\t\treturn valueFilter(filters.GeoRange{\n\t\t\tDistance: float32(in.ValueGeoRange.Distance.Max),\n\t\t\tGeoCoordinates: &models.GeoCoordinates{\n\t\t\t\tLatitude:  in.ValueGeoRange.GeoCoordinates.Latitude,\n\t\t\t\tLongitude: in.ValueGeoRange.GeoCoordinates.Longitude,\n\t\t\t},\n\t\t}, schema.DataTypeGeoCoordinates), nil\n\t},","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/rest/filterext/parse_value.go#L128-L164","documentation":"Validation error in the geo-range branch of filterext's where-filter value parser: a ValueGeoRange was supplied with a distance object whose Distance field is nil. The distance (max) is mandatory for WithinGeoRange semantics, so the filter is rejected before it reaches the filter compiler.","triggerScenarios":"A nearText/nearObject-style where geoRange filter sent as {valueGeoRange: {geoCoordinates: {...}}} without the distance object, or with distance misspelled.","commonSituations":"Clients building GeoRange payloads manually instead of via SDK helpers; API version differences where older clients used a flat latitude/longitude/number shape.","solutions":["Add the distance object: valueGeoRange: {distance: {max: 2000}, geoCoordinates: {latitude: 51.5, longitude: -0.09}}","Use the SDK's GeoRange/GeoCoordinates helper types so required nested fields are enforced","Validate the payload structure client-side before sending"],"exampleFix":"// before\n\"valueGeoRange\": {\"geoCoordinates\": {\"latitude\": 51.5, \"longitude\": -0.09}}\n// after\n\"valueGeoRange\": {\"geoCoordinates\": {\"latitude\": 51.5, \"longitude\": -0.09}, \"distance\": {\"max\": 2000}}","handlingStrategy":"validation","validationCode":"function validateGeoRange(g) {\n  if (!g.distance || typeof g.distance.max !== 'number') throw new Error('valueGeoRange.distance.max is required');\n}","typeGuard":"function hasDistance(g) { return g != null && typeof g.distance === 'object' && g.distance !== null && typeof g.distance.max === 'number'; }","tryCatchPattern":"try { await queryWithGeo(g); } catch (e) { if (/field 'distance' must be set/.test(e.message)) console.error('Add distance: {max: <meters>} to valueGeoRange'); else throw e; }","preventionTips":["Always build geo filters with SDK GeoRange helpers","Include both geoCoordinates and distance in every geoRange","Unit-test filter payload construction"],"tags":["geo","validation","filter"],"backgroundTag":"missing-required-argument","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}