{"record":{"id":"db41bfd846c774e0","repo":"SigNoz/signoz","slug":"invalid-data-type-expected-bool-got-v","errorCode":null,"errorMessage":"invalid data type, expected bool, got %v","messagePattern":"invalid data type, expected bool, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/query-service/utils/format.go","lineNumber":58,"sourceCode":"\t\t\t\t\tx[i] = fmt.Sprintf(\"%v\", val)\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected string, got %v\", reflect.TypeOf(val))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn x, nil\n\t\tcase []string:\n\t\t\treturn x, nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected string, got %v\", reflect.TypeOf(v))\n\t\t}\n\tcase v3.AttributeKeyDataTypeBool:\n\t\tswitch x := v.(type) {\n\t\tcase []interface{}:\n\t\t\tfor i, val := range x {\n\t\t\t\tif _, ok := val.(string); ok {\n\t\t\t\t\tboolean, err := strconv.ParseBool(val.(string))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected bool, got %v\", reflect.TypeOf(val))\n\t\t\t\t\t}\n\t\t\t\t\tx[i] = boolean\n\t\t\t\t} else if _, ok := val.(bool); !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected bool, got %v\", reflect.TypeOf(val))\n\t\t\t\t} else {\n\t\t\t\t\tx[i] = val.(bool)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn x, nil\n\t\tcase bool:\n\t\t\treturn x, nil\n\t\tcase string:\n\t\t\tboolean, err := strconv.ParseBool(x)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected bool, got %v\", reflect.TypeOf(v))\n\t\t\t}\n\t\t\treturn boolean, nil\n\t\tdefault:","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/utils/format.go#L40-L76","documentation":"For bool-typed attribute keys with []interface{} values, string elements are parsed with strconv.ParseBool. This error fires when a string element fails parsing — i.e. not one of 1/t/T/TRUE/true/True/0/f/F/FALSE/false/False.","triggerScenarios":"{\"value\":[\"yes\"]} or [\"on\"] for a boolean attribute key in a traces filter.","commonSituations":"Users typing yes/no or on/off instead of true/false; UI dropdowns emitting labels rather than boolean literals.","solutions":["Use \"true\"/\"false\" (or 1/0) strings","Configure the UI to emit boolean literals for bool-typed keys"],"exampleFix":"// before\n{\"value\":[\"yes\"]}\n// after\n{\"value\":[\"true\"]}","handlingStrategy":"validation","validationCode":"for _, el := range arr { if s, ok := el.(string); ok { if _, err := strconv.ParseBool(s); err != nil { return fmt.Errorf(\"%q not a bool literal\", s) } } }","typeGuard":"func isBoolLiteral(s string) bool { _, err := strconv.ParseBool(s); return err == nil }","tryCatchPattern":null,"preventionTips":["Use only true/false (or 1/0) strings for bool attributes","UI dropdowns should emit boolean literals, not labels"],"tags":["signoz","filters","boolean","type-mismatch"],"backgroundTag":"filter-value-type-mismatch","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}