{"record":{"id":"e56786b696b7f5b1","repo":"SigNoz/signoz","slug":"invalid-data-type-expected-float-bool-int-stri","errorCode":null,"errorMessage":"invalid data type, expected float, bool, int, string or []interface{} but got %v","messagePattern":"invalid data type, expected float, bool, int, string or \\[\\]interface(.+?) but got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/query-service/utils/format.go","lineNumber":152,"sourceCode":"\t\t\t}\n\t\t\treturn x, nil\n\t\tcase float32, float64:\n\t\t\treturn x, nil\n\t\tcase string:\n\t\t\tfloat64val, err := strconv.ParseFloat(x, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected float, got %v\", reflect.TypeOf(v))\n\t\t\t}\n\t\t\treturn float64val, nil\n\t\tcase int:\n\t\t\treturn float64(x), nil\n\t\tcase int64:\n\t\t\treturn float64(x), nil\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"invalid data type, expected float, got %v\", reflect.TypeOf(v))\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid data type, expected float, bool, int, string or []interface{} but got %v\", dataType)\n\t}\n}\n\nfunc QuoteEscapedString(str string) string {\n\t// https://clickhouse.com/docs/en/sql-reference/syntax#string\n\tstr = strings.ReplaceAll(str, `\\`, `\\\\`)\n\tstr = strings.ReplaceAll(str, `'`, `\\'`)\n\treturn str\n}\n\nfunc QuoteEscapedStringForContains(str string, isIndex bool) string {\n\t// https: //clickhouse.com/docs/en/sql-reference/functions/string-search-functions#like\n\tstr = QuoteEscapedString(str)\n\n\t// we are adding this because if a string contains quote `\"` it will be stored as \\\" in clickhouse\n\t// to query that using like our query should be \\\\\\\\\"\n\tif isIndex {\n\t\t// isIndex is true means that the extra slash is present","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/utils/format.go#L134-L170","documentation":"ValidateAndCastValue was called with a dataType that is none of the supported attribute key types (bool, string, int64, float64). The whole switch fell to the outer default and the unsupported dataType value is printed.","triggerScenarios":"Constructing a v3.AttributeKey with an unrecognized DataType value (e.g. a raw integer from an out-of-range enum, an empty DataType, or a newly added type the deployed SigNoz version doesn't handle) and passing its filter to buildTracesFilterQuery/BuildTracesFilterQuery.","commonSituations":"Version skew between frontend/backend and query-service (new data type added in newer SigNoz); manually crafted v3.FilterItem with unset DataType; serialized enum from another language sending numeric values.","solutions":["Upgrade all SigNoz components (frontend, OtelCollector, query-service) to the same version so DataType enums match","Set an explicit supported DataType (v3.AttributeKeyDataTypeBool/String/Int64/Float64) on every filter key","If a custom/untyped filter is needed, default it to String before calling the builder"],"exampleFix":"// before\nkey := v3.AttributeKey{DataType: v3.AttributeKeyDataType(99)}\n// after\nkey := v3.AttributeKey{DataType: v3.AttributeKeyDataTypeString}","handlingStrategy":"validation","validationCode":"switch key.DataType {\ncase v3.AttributeKeyDataTypeBool, v3.AttributeKeyDataTypeString, v3.AttributeKeyDataTypeInt64, v3.AttributeKeyDataTypeFloat64:\ndefault:\n\treturn badRequest(\"unsupported filter data type %d\", key.DataType)\n}","typeGuard":"func isSupportedDataType(dt v3.AttributeKeyDataType) bool { return dt >= 0 && dt <= v3.AttributeKeyDataTypeFloat64 }","tryCatchPattern":"if _, err := utils.ValidateAndCastValue(v, key.DataType); err != nil { return 400 }","preventionTips":["Always set DataType explicitly on v3.AttributeKey","Keep SigNoz frontend/backend/collector versions aligned"],"tags":["signoz","enum-validation","unsupported-type","go"],"backgroundTag":"unsupported-enum-value","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}