{"record":{"id":"036c733fb8e14f4b","repo":"weaviate/weaviate","slug":"longitude-must-be-set","errorCode":null,"errorMessage":"longitude must be set","messagePattern":"longitude must be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/vector/geo/coordinates_for_id.go","lineNumber":64,"sourceCode":"\tif err != nil || coordinates == nil {\n\t\treturn nil, err\n\t}\n\n\treturn geoCoordiantesToVector(coordinates)\n}\n\n// GeoCoordinatesToVector converts geo coordinates to a vector of [lat, lon].\nfunc GeoCoordinatesToVector(in *models.GeoCoordinates) ([]float32, error) {\n\treturn geoCoordiantesToVector(in)\n}\n\nfunc geoCoordiantesToVector(in *models.GeoCoordinates) ([]float32, error) {\n\tif in.Latitude == nil {\n\t\treturn nil, fmt.Errorf(\"latitude must be set\")\n\t}\n\n\tif in.Longitude == nil {\n\t\treturn nil, fmt.Errorf(\"longitude must be set\")\n\t}\n\n\treturn []float32{*in.Latitude, *in.Longitude}, nil\n}\n","sourceCodeStart":46,"sourceCodeEnd":69,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/vector/geo/coordinates_for_id.go#L46-L69","documentation":"The longitude half of the same validation: geoCoordiantesToVector builds the [lat, lon] vector and fails when Longitude is nil even if latitude is present. Both coordinates must be non-nil to produce a usable 2D geo vector.","triggerScenarios":"Adding or searching geo data where GeoCoordinates contains only latitude — e.g. {\"geoCoordinates\": {\"latitude\": 52.36}} passed to an insert or a WithinGeoRange query.","commonSituations":"Partial geographic data from upstream sources, client forms that make longitude optional, or deserialization dropping the longitude field because it was null in the payload.","solutions":["Set the Longitude field on the GeoCoordinates object before the call","Validate that both latitude and longitude are present at ingest/query time and reject partial geo values","Coerce upstream data (e.g. default or reject records) so longitude is never null for geo properties"],"exampleFix":"// before\ngeo := &models.GeoCoordinates{Latitude: &lat}\nvec, err := geo.GeoCoordinatesToVector(geo) // error: longitude must be set\n// after\ngeo := &models.GeoCoordinates{Latitude: &lat, Longitude: &lon}\nvec, err := geo.GeoCoordinatesToVector(geo)","handlingStrategy":"validation","validationCode":"func validGeo(g *models.GeoCoordinates) bool {\n    return g != nil && g.Latitude != nil && g.Longitude != nil\n}","typeGuard":"func hasLatLon(g *models.GeoCoordinates) bool {\n    return g != nil && g.Longitude != nil && g.Latitude != nil\n}","tryCatchPattern":"vec, err := geo.GeoCoordinatesToVector(g)\nif err != nil {\n    return fmt.Errorf(\"invalid geo input: %w\", err)\n}","preventionTips":["Treat longitude as mandatory for all geo properties","Sanitize upstream data: drop or fix records with null longitude","Unit-test geo ingestion with partial-coordinate payloads"],"tags":["go","geo","validation"],"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"}