{"record":{"id":"7f6bd2cf125d3925","repo":"gofiber/fiber","slug":"unsupported-value-type-t","errorCode":null,"errorMessage":"unsupported value type: %T","messagePattern":"unsupported value type: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"binder/mapping.go","lineNumber":373,"sourceCode":"\t\treturn content[:i]\n\t}\n\treturn content\n}\n\nfunc formatBindData[T, K any](aliasTag string, out any, data map[string][]T, key string, value K, enableSplitting, supportBracketNotation bool) error { //nolint:revive // it's okay\n\tvar err error\n\tif supportBracketNotation && strings.IndexByte(key, '[') >= 0 {\n\t\tkey, err = parseParamSquareBrackets(key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tswitch v := any(value).(type) {\n\tcase string:\n\t\tdataMap, ok := any(data).(map[string][]string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unsupported value type: %T\", value)\n\t\t}\n\n\t\tassignBindData(aliasTag, out, dataMap, key, v, enableSplitting)\n\tcase []string:\n\t\tdataMap, ok := any(data).(map[string][]string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unsupported value type: %T\", value)\n\t\t}\n\n\t\tfor _, val := range v {\n\t\t\tassignBindData(aliasTag, out, dataMap, key, val, enableSplitting)\n\t\t}\n\tcase []*multipart.FileHeader:\n\t\tfor _, val := range v {\n\t\t\tvalT, ok := any(val).(T)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"unsupported value type: %T\", value)\n\t\t\t}","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/gofiber/fiber/blob/a105acad6c1e4576a77f01e02973f67e962bb58d/binder/mapping.go#L355-L391","documentation":"In binder/mapping.go, when value is a string the function expects data to be map[string][]string; it asserts `any(data).(map[string][]string)`. If the assertion fails (data is some other map or non-map type), it returns fmt.Errorf(\"unsupported value type: %T\", value). Note: the message formats value's type but the actual mismatch is on data.","triggerScenarios":"Calling the internal mapping helper with a data argument that is not map[string][]string while the value being assigned is a string. Typically reached only via custom bind sources or direct calls into binder internals.","commonSituations":"Custom binder extensions passing the wrong data shape; user-defined bind helpers that bypass the standard pipeline; integrations that build their own data maps with different value element types.","solutions":["Pass data as map[string][]string when invoking the mapping helper.","Use the public binder APIs rather than internal mapping functions.","Add a type assertion on data before binding so the failure surface is explicit."],"exampleFix":"// before\ndata := map[string]string{\"k\": \"v\"}     // wrong element type\nbinder.Map(data, out, ...)\n\n// after\ndata := map[string][]string{\"k\": {\"v\"}}\nbinder.Map(data, out, ...)","handlingStrategy":"type-guard","validationCode":"dm, ok := any(data).(map[string][]string)\nif !ok { return errors.New(\"data must be map[string][]string\") }","typeGuard":"func isStringDataMap(data any) bool {\n    _, ok := data.(map[string][]string)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Always pass data as map[string][]string.","Prefer public binder APIs over internal mapping helpers.","Wrap values as []string{v} when starting from single values."],"tags":["bind","type-mismatch","internal","validation"],"backgroundTag":null,"analyzedSha":"a105acad6c1e4576a77f01e02973f67e962bb58d","analyzedAt":"2026-08-11T17:33:26.942Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}