SigNoz/signoz · error
invalid data type, expected bool, got %v
Error message
invalid data type, expected bool, got %v
What it means
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.
Source
Thrown at pkg/query-service/utils/format.go:58
x[i] = fmt.Sprintf("%v", val)
} else {
return nil, fmt.Errorf("invalid data type, expected string, got %v", reflect.TypeOf(val))
}
}
return x, nil
case []string:
return x, nil
default:
return nil, fmt.Errorf("invalid data type, expected string, got %v", reflect.TypeOf(v))
}
case v3.AttributeKeyDataTypeBool:
switch x := v.(type) {
case []interface{}:
for i, val := range x {
if _, ok := val.(string); ok {
boolean, err := strconv.ParseBool(val.(string))
if err != nil {
return nil, fmt.Errorf("invalid data type, expected bool, got %v", reflect.TypeOf(val))
}
x[i] = boolean
} else if _, ok := val.(bool); !ok {
return nil, fmt.Errorf("invalid data type, expected bool, got %v", reflect.TypeOf(val))
} else {
x[i] = val.(bool)
}
}
return x, nil
case bool:
return x, nil
case string:
boolean, err := strconv.ParseBool(x)
if err != nil {
return nil, fmt.Errorf("invalid data type, expected bool, got %v", reflect.TypeOf(v))
}
return boolean, nil
default:View on GitHub (pinned to 5069bf80b0)
Solutions
- Use "true"/"false" (or 1/0) strings
- Configure the UI to emit boolean literals for bool-typed keys
Example fix
// before
{"value":["yes"]}
// after
{"value":["true"]} Defensive patterns
Strategy: validation
Validate before calling
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) } } } Type guard
func isBoolLiteral(s string) bool { _, err := strconv.ParseBool(s); return err == nil } Prevention
- Use only true/false (or 1/0) strings for bool attributes
- UI dropdowns should emit boolean literals, not labels
When it happens
Trigger: {"value":["yes"]} or ["on"] for a boolean attribute key in a traces filter.
Common situations: Users typing yes/no or on/off instead of true/false; UI dropdowns emitting labels rather than boolean literals.
Related errors
- invalid data type, expected string, got %v
- invalid value for key %s: %v
- unsupported operator %s
- invalid value for key %s: %v
- existingFilterItems must contain a valid key
AI-assisted analysis of SigNoz/signoz@5069bf80b0 (2026-08-28).
Data as JSON: /api/errors/db41bfd846c774e0.
Report an issue: GitHub.