{"record":{"id":"57c506ec635ce536","repo":"weaviate/weaviate","slug":"element-d-expected-boolean-element-to-be-bool-b","errorCode":null,"errorMessage":"element %d: expected boolean element to be bool, but got %T","messagePattern":"element (.+?): expected boolean element to be bool, but got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/traverser/grouper/merge_group.go","lineNumber":227,"sourceCode":"\tfor i, elem := range in {\n\t\tasFloat, ok := elem.(float64)\n\t\tif !ok {\n\t\t\treturn 0, fmt.Errorf(\"element %d: expected numerical element to be float64, but got %T\", i, elem)\n\t\t}\n\n\t\tsum += asFloat\n\t}\n\n\treturn sum / float64(len(in)), nil\n}\n\nfunc mergeBooleanProps(in []interface{}) (bool, error) {\n\tvar countTrue uint\n\tvar countFalse uint\n\tfor i, elem := range in {\n\t\tasBool, ok := elem.(bool)\n\t\tif !ok {\n\t\t\treturn false, fmt.Errorf(\"element %d: expected boolean element to be bool, but got %T\", i, elem)\n\t\t}\n\n\t\tif asBool {\n\t\t\tcountTrue++\n\t\t} else {\n\t\t\tcountFalse++\n\t\t}\n\t}\n\n\treturn countTrue >= countFalse, nil\n}\n\nfunc mergeGeoProps(in []interface{}) (*models.GeoCoordinates, error) {\n\tvar sumLat float32\n\tvar sumLon float32\n\n\tfor i, elem := range in {\n\t\tasGeo, ok := elem.(*models.GeoCoordinates)","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/traverser/grouper/merge_group.go#L209-L245","documentation":"mergeBooleanProps reduces grouped boolean values during groupBy (majority vote: returns true if countTrue >= countFalse pattern of counting). Every element must be a Go bool; anything else aborts with the index and actual type.","triggerScenarios":"A groupBy query over a boolean property where an extracted element is not bool — e.g. the value was written as the string \"true\"/\"false\" or 0/1 and decoded as string/number.","commonSituations":"Clients sending booleans as strings or numbers on import, causing stored/extracted values to deserialize into non-bool types during grouped merging.","solutions":["Verify the property dataType is boolean and values were imported as real JSON booleans","Fix clients writing \"true\" strings or 1/0 into boolean properties","Re-import or update offending objects with proper boolean values","Check the error's element index and property name (from the wrapping 'prop' error) to locate the bad data"],"exampleFix":"// before (bad import)\n{\"hasStock\": \"true\"}\n// after\n{\"hasStock\": true}","handlingStrategy":"validation","validationCode":"// Validate booleans before import\nfor (const obj of objects) {\n  if (obj.inStock !== undefined && typeof obj.inStock !== 'boolean') {\n    throw new Error('inStock must be a real boolean, got ' + typeof obj.inStock)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Send true/false, not \"true\"/\"false\" or 1/0, for boolean properties","Add client-side schema validation before batch imports","Re-check legacy data written by old clients with string booleans","Use the error's element index to locate the corrupt object when debugging"],"tags":["graphql","groupby","type-mismatch","boolean"],"backgroundTag":"unexpected-type-in-group-merge","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"}