{"record":{"id":"f3405dbc93fe406e","repo":"weaviate/weaviate","slug":"invalid-latitude-w","errorCode":null,"errorMessage":"invalid latitude: %w","messagePattern":"invalid latitude: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/objects/validation/properties_validation.go","lineNumber":509,"sourceCode":"\n\tlon, ok := inputMap[\"longitude\"]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"geoCoordinates is missing required field 'longitude'\")\n\t}\n\n\tlat, ok := inputMap[\"latitude\"]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"geoCoordinates is missing required field 'latitude'\")\n\t}\n\n\tlonFloat, err := parseCoordinate(lon)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid longitude: %w\", err)\n\t}\n\n\tlatFloat, err := parseCoordinate(lat)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid latitude: %w\", err)\n\t}\n\n\treturn &models.GeoCoordinates{\n\t\tLongitude: ptFloat32(float32(lonFloat)),\n\t\tLatitude:  ptFloat32(float32(latFloat)),\n\t}, nil\n}\n\nfunc ptFloat32(in float32) *float32 {\n\treturn &in\n}\n\nfunc phoneNumber(data interface{}) (*models.PhoneNumber, error) {\n\tdataMap, ok := data.(map[string]interface{})\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"phoneNumber must be a map, but got: %T\", data)\n\t}\n","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/objects/validation/properties_validation.go#L491-L527","documentation":"Same mechanism as the longitude case: the 'latitude' value is run through parseCoordinate, and if it cannot be interpreted as a float (e.g. a string), the error is wrapped as 'invalid latitude: ...'. Both coordinates must be numeric JSON values for the geoCoordinates property to validate.","triggerScenarios":"geoCoordinates latitude sent as a string (\"52.5\"), boolean, null, or object — e.g. {\"latitude\": \"52.5\", \"longitude\": 13.4} — during POST /v1/objects, PATCH, or batch import.","commonSituations":"Spreadsheet/CSV exports where latitude arrives as text; clients from regions where decimal commas produce strings like \"52,5\"; serialization frameworks that convert numbers to strings.","solutions":["Send latitude as an unquoted JSON number: {\"latitude\": 52.5} not {\"latitude\": \"52.5\"}.","Normalize decimal commas to dots and parse to float in the ETL step before submission.","Verify latitude is within valid range (-90 to 90).","Inspect the wrapped cause after 'invalid latitude:' to identify the exact offending value type."],"exampleFix":"// before\n{\"location\": {\"latitude\": \"52.5\", \"longitude\": 13.4}}\n// after\n{\"location\": {\"latitude\": 52.5, \"longitude\": 13.4}}","handlingStrategy":"validation","validationCode":"function validateLatitude(v) {\n  const n = typeof v === 'string' ? Number(v.replace(',', '.')) : v;\n  if (typeof n !== 'number' || Number.isNaN(n) || n < -90 || n > 90) {\n    throw new Error(`invalid latitude value: ${JSON.stringify(v)}`);\n  }\n}","typeGuard":"const isNumeric = (v) => typeof v === 'number' || (typeof v === 'string' && v.trim() !== '' && Number.isFinite(Number(v)));","tryCatchPattern":null,"preventionTips":["Normalize decimal commas to dots before parsing latitude strings","Range-check latitude to [-90, 90]","Force string type for phone/coordinate-like columns in CSV importers so leading characters survive"],"tags":["validation","geo","numbers","weaviate"],"backgroundTag":"coordinate-type-invalid","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"}