{"id":"d35c75e6c2a1d475","repo":"gin-gonic/gin","slug":"s-is-not-supported-in-the-collection-format-mul","errorCode":null,"errorMessage":"%s is not supported in the collection_format. (multi, csv, ssv, tsv, pipes)","messagePattern":"(.+?) is not supported in the collection_format\\. \\(multi, csv, ssv, tsv, pipes\\)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"binding/form_mapping.go","lineNumber":230,"sourceCode":"\nfunc trySplit(vs []string, field reflect.StructField) (newVs []string, err error) {\n\tcfTag := field.Tag.Get(\"collection_format\")\n\tif cfTag == \"\" || cfTag == \"multi\" {\n\t\treturn vs, nil\n\t}\n\n\tvar sep string\n\tswitch cfTag {\n\tcase \"csv\":\n\t\tsep = \",\"\n\tcase \"ssv\":\n\t\tsep = \" \"\n\tcase \"tsv\":\n\t\tsep = \"\\t\"\n\tcase \"pipes\":\n\t\tsep = \"|\"\n\tdefault:\n\t\treturn vs, fmt.Errorf(\"%s is not supported in the collection_format. (multi, csv, ssv, tsv, pipes)\", cfTag)\n\t}\n\n\ttotalLength := 0\n\tfor _, v := range vs {\n\t\ttotalLength += strings.Count(v, sep) + 1\n\t}\n\tnewVs = make([]string, 0, totalLength)\n\tfor _, v := range vs {\n\t\tnewVs = append(newVs, strings.Split(v, sep)...)\n\t}\n\n\treturn newVs, nil\n}\n\nfunc setByForm(value reflect.Value, field reflect.StructField, form map[string][]string, tagValue string, opt setOptions) (isSet bool, err error) {\n\tvs, ok := form[tagValue]\n\tif !ok && !opt.isDefaultExists {\n\t\treturn false, nil","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/gin-gonic/gin/blob/34dac209ffb6ef85cc78c5d217bbb7ad001d68fd/binding/form_mapping.go#L212-L248","documentation":"Returned by trySplit (binding/form_mapping.go:230) when a struct field carries a collection_format tag whose value is not one of the supported separators (multi, csv, ssv, tsv, pipes). The tag controls how a single form value is split into slice/array elements.","triggerScenarios":"Tagging a slice/array field with collection_format:\"comma\" (should be csv), collection_format:\"pipe\" (should be pipes), collection_format:\"json\", or a typo like collection_format:\"CSV\".","commonSituations":"Copy-paste from OpenAPI spec names that differ from Gin's tag values; case mismatch (CSV vs csv); leftover tag from a different framework.","solutions":["Use one of the supported values: multi (default, no split), csv (comma), ssv (space), tsv (tab), pipes (|).","Remove the collection_format tag entirely if multi behaviour is what you want.","Double-check spelling and case — values are lowercase and exact."],"exampleFix":"// before\ntype Q struct {\n    Tags []string `form:\"tags\" collection_format:\"comma\"`\n}\n// after\ntype Q struct {\n    Tags []string `form:\"tags\" collection_format:\"csv\"`\n}","handlingStrategy":"validation","validationCode":"var validCF = map[string]bool{\"\": true, \"multi\": true, \"csv\": true, \"ssv\": true, \"tsv\": true, \"pipes\": true}\n// at startup, walk struct tags:\nfunc checkCollectionFormatTags(t reflect.Type) error {\n    for i := 0; i < t.NumField(); i++ {\n        cf := t.Field(i).Tag.Get(\"collection_format\")\n        if cf != \"\" && !validCF[cf] {\n            return fmt.Errorf(\"field %s has invalid collection_format %q\", t.Field(i).Name, cf)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := c.ShouldBind(&q); err != nil {\n    if strings.Contains(err.Error(), \"is not supported in the collection_format\") {\n        // fix the tag to one of multi|csv|ssv|tsv|pipes\n    }\n}","preventionTips":["Use only multi, csv, ssv, tsv, pipes for collection_format tags.","Prefer csv for comma-separated single-value slices; omit the tag for multi.","Add a unit test that binds a representative request for each tagged field."],"tags":["binding","form","collection-format","go"],"analyzedSha":"34dac209ffb6ef85cc78c5d217bbb7ad001d68fd","analyzedAt":"2026-08-04T21:26:18.438Z","schemaVersion":2}